pl/sql(1)
1 PLS_INTEGER
PLS_INTEGER¿ÉÒÔ´æ´¢Ò»¸öÓзûºÅµÄÕûÐÎÖµ£¬Æ侫¶È·¶Î§ºÍBINARY_INTEGERÒ»Ñù£¬ÊÇ£º-2^31~2^31¡£
PLS_INTEGERºÍNUMBER±È½ÏÆðÀ´£¬ÆäÓŵãÊÇ£º
1).Õ¼ÓнÏÉٵĴ洢¿Õ¼ä£»
2).¿ÉÒÔÖ±½Ó½øÐÐËãÊõÔËË㣨ÔÚNUMBERÉϲ»ÄÜÖ±½Ó½øÐÐËãÊõÔËË㣬Èç¹ûÒª¼ÆË㣬NUMBER±ØÐëÏȱ»×ª»»³É¶þ½øÖÆ£©¡£ËùÒÔÔÚ½øÐÐËãÊõµÄʱºòPLS_INTEGER±ÈNUMBERºÍBINARY_INTEGER¿ìһЩ¡£
2 %TYPE %ROWTYPE
v_FirstName students.first_name%TYPE;
DECLARE
¡¡¡¡ /*Define a record type to hold common student informationi*/
¡¡¡¡ TYPE t_StudentRecord IS RECORD(
¡¡¡¡ StudentID NUMBER(5),
¡¡¡¡ FirstName VARCHAR2(20),
¡¡¡¡ LastName VARCHAR2(20);
t_St t_StudentRecord;
V_TETS t_StudentRecord%rowtype;
Ïà¹ØÎĵµ£º
Select * from tableName
exec('select * from tableName')
exec sp_executesql N'select * from tableName' -- Çë×¢Òâ×Ö·û´®Ç°Ò»¶¨Òª¼ÓN
2:×Ö¶ÎÃû£¬±íÃû£¬Êý¾Ý¿âÃûÖ®Àà×÷Ϊ±äÁ¿Ê±£¬±ØÐëÓö¯Ì¬SQL
declare @fname varchar(20)
set @fname = 'FiledName'
Select @fname from tableName -- ´íÎó,²»»áÌáʾ´í ......
sql×¢È룬ËùνSQL×¢È룬¾ÍÊÇͨ¹ý°ÑSQLÃüÁî²åÈëµ½Web±íµ¥µÝ½»»òÊäÈëÓòÃû»òÒ³ÃæÇëÇóµÄ²éѯ×Ö·û´®£¬×îÖÕ´ïµ½ÆÛÆ·þÎñÆ÷Ö´ÐжñÒâµÄSQLÃüÁ±ÈÈçÏÈÇ°µÄºÜ¶àÓ°ÊÓÍøվй¶VIP»áÔ±ÃÜÂë´ó¶à¾ÍÊÇͨ¹ýWEB±íµ¥µÝ½»²éѯ×Ö·û±©³öµÄ£¬ÕâÀà±íµ¥ÌرðÈÝÒ×Êܵ½SQL×¢Èëʽ¹¥»÷£®
¡¡¡¡µ±Ó¦ÓóÌÐòʹÓÃÊäÈëÄÚÈÝÀ´¹¹Ô춯 ......
1¡¢Î½´Ê ν´ÊÔÊÐíÄú¹¹ÔìÌõ¼þ£¬ÒÔ±ãÖ»´¦ÀíÂú×ãÕâЩÌõ¼þµÄÄÇЩÐС£
2¡¢Ê¹Óà IN ν´Ê
ʹÓà IN ν´Ê½«Ò»¸öÖµÓëÆäËû¼¸¸öÖµ½øÐбȽϡ£ÀýÈ磺
SELECT NAME from STAFF WHERE DEPT IN (20, 15)
´ËʾÀýÏ൱ÓÚ£º
SELECT NAME from STAFF WHERE DEPT = 20 OR DEPT = 15
µ±×Ó²éѯ·µ»ØÒ»×éֵʱ£¬¿ÉʹÓà IN ºÍ NOT IN ÔËËã·û¡£ÀýÈç£ ......
Ìõ¼þ£º
ÓµÓÐsaȨÏÞ
¿ªÆô xp_cmdshell
·½·¨£º
¿ªÆô/¹Ø±Õ xp_cmdshell ±ØÐëÔÚ master ¿âÖ´ÐÐ
EXEC sp_configure 'show advanced options', 1
RECONFIGURE WITH OVERRIDE
EXEC sp_configure 'xp_cmdshell', 1
RECONFIGURE ......
Ò»¡¢¼Ó¿ìsqlµÄÖ´ÐÐËÙ¶È
¡¡¡¡1.select Óï¾äÖÐʹÓÃsort,»òjoin
¡¡¡¡Èç¹ûÄãÓÐÅÅÐòºÍÁ¬½Ó²Ù×÷£¬Äã¿ÉÒÔÏÈselectÊý¾Ýµ½Ò»¸öÁÙʱ±íÖУ¬È»ºóÔÙ¶ÔÁÙʱ±í½øÐд¦Àí¡£ÒòΪÁÙʱ±íÊǽ¨Á¢ÔÚÄÚ´æÖУ¬ËùÒԱȽ¨Á¢ÔÚ´ÅÅÌÉϱí²Ù×÷Òª¿ìµÄ¶à¡£
¡¡¡¡È磺
SELECT time_records.*, case_name¡¡
from time_records, OUTER cases¡¡
WHERE time_re ......