Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

PL/SQLÀý×Ó

ÒÔÏÂÊǾ­²âÑéÄÜÕýÈ·ÔËÐеÄ:
create    table t_emp_log212
(
who varchar2(10) not null,
action varchar2(10) not null,
actime date
);
create or replace trigger tri_emp_insert
before insert
on t_emp
begin
insert into t_emp_log(who,action,actime)values(user,'insert',sysdate);
end;
-------------------------------------------------------------------------------------------
set serveroutput on
declare
 v_empno emp.empno%type:=&empno;
 v_ename emp.ename%type;
 begin
select empno, ename into v_empno,v_ename from emp where empno=v_empno;
dbms_output.put_line(v_ename);
exception
 when others then
 dbms_output.put_line(' your empno is null,ename is null');
end;
-------------------------------------------------------------------------------------------
SET SERVEROUTPUT ON
declare
type tabletype1 is table of varchar2(10) index by binary_integer;
type tabletype2 is table of varchar2(10) index  by binary_integer;
table1 tabletype1;
table2 tabletype2;
begin
 table1(1):='´óѧ';
 table1(2):='´óר';
  table2(1):=88;
  table2(2):=55;
dbms_output.put_line(table1(1)||table2(1));
dbms_output.put_line(table1(2)||table2(2));
end;
-------------------------------------------------------------------------------------------
set serveroutput on;
declare
   v_grade char(10):=upper('&p_grade');/*upper½«×Ö·û´®È«±ä´óд ±ØÐë¼ÓÒýºÅ ÒòΪ¸³ÖµÒÔºóÏÔʾΪupper£¨'A'£©¶øupper£¨A£©A×÷Ϊ³£Á¿ÁË*/
   v_result varchar2(20);
begin
 v_result:=
  case v_grade
  when 'A' then '90 ·ÖÒÔÉÏ'
  when 'B' then '80·Öµ½90·ÖÖ®¼ä'
  when 'C' then '60·Öµ½80·ÖÖ®¼ä'
  else '²»¼°¸ñ'
end;
dbms_output.put_line('grade'||v_grade||'result'||v_result);
end;
-------------------------------------------------------------------------------------------
set serverout on
declare
 v_item number(3):=1;
 begin
loop
  dbms_output.put_line(v_item);


Ïà¹ØÎĵµ£º

SQL SERVER ²é¿´Óû§È¨ÏÞ

--Óû§Óë½ÇÉ«¹Øϵ
select a.uid as uid,a.status as uStatus,a.name as uName,
  b.uid as rId,b.status as rStatus,b.name as rName
from sysusers a inner join sysusers b on a.gid = b.uid
where a.issqlrole = 0 and a.isapprole = 0 and a.hasdbaccess = 1 and (b.issqlrole = 1 or b.isapprole = 1)
......

Sql³£¼ûÃæÊÔÌâ ÊÜÓÃÁË

1.
ÓÃÒ»ÌõSQL
Óï¾ä ²éѯ³öÿÃſζ¼´óÓÚ80
·ÖµÄѧÉúÐÕÃû
name   kecheng   fenshu
ÕÅÈý    
ÓïÎÄ       81
ÕÅÈý    
Êýѧ       75
ÀîËÄ    
ÓïÎÄ &nbs ......

sql server Óë oracle µÄÇø±ð

ÎÒÏÈÅ×שÒýÓñ:      
     
  1.     ¿ª·¢ÐÔ:     SQLSERVER²»ÄÜ,ORACLEÄÜ×°ÔÚUNIXÉÏ      
  2.     ·ÖÇø±í:     SQLSERVER²»Ä ......

sqlÓëhqlµÄÇø±ð

sqlÊǹØϵÊý¾Ý¿â²éѯÓïÑÔ,Ãæ¶ÔµÄÊý¾Ý¿â;
¶øhqlÊÇHibernateÕâÑùµÄÊý¾Ý¿â³Ö¾Ã»¯¿ò¼ÜÌṩµÄÄÚÖòéѯÓïÑÔ,ËäÈ»ËûÃǵÄÄ¿µÄ¶¼ÊÇΪÁË´ÓÊý¾Ý¿â²éѯÐèÒªµÄÊý¾Ý,µ«sql²Ù×÷µÄÊÇÊý¾Ý¿â±íºÍ×Ö¶Î,
¶ø×÷ΪÃæÏò¶ÔÏóµÄhql²Ù×÷µÄÔòÊdz־û¯À༰ÆäÊôÐÔ¡£
¾ÙÒ»¸ö¼òµ¥µÄÀý×Ó
sqlÓï¾ä
select * from tb_goods where id in (select goodsid f ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ