PL/SQL ѧϰ±Ê¼Ç1
PL/SQL ²»¾ß±¸ÊäÈëÊä³öµÄÄÜÁ¦
µ«ÊÇ¿ÉÒÔÒÀ¿¿»·¾³À´Ö´ÐÐÊýÖµµÄÊäÈëÊä³ö¸øPL/SQL ¿é
SQLPLUS »·¾³ÓÃsubstitution variables ºÍ host(bind) variable À´´«ÈëÊýÖµ¸øPL/SQL¿é
substitution variable: such as a preceding ampersand &a
host(bind) variable : such as a preceding colon :x
Ìæ´ú±äÁ¿¿ÉÒÔ²»ÓÃÉùÃ÷£¬µ«ÊÇ»áÔÚÖ´ÐеÄʱºòÓÐÒ»¸ö½»»¥Ê½Ìáʾ
°ó¶¨±äÁ¿ÐèÒªÉùÃ÷²¢ÇÒ¸³ÖµµÄʱºòÓÃexecÓï¾ä
SQL> var df df
Usage: VAR[IABLE] [ <variable> [ NUMBER | CHAR | CHAR (n [CHAR|BYTE]) |
VARCHAR2 (n [CHAR|BYTE]) | NCHAR | NCHAR (n) |
NVARCHAR2 (n) | CLOB | NCLOB | REFCURSOR |
BINARY_FLOAT | BINARY_DOUBLE ] ]
SQL> var a number
SQL> exec :a :=123
PL/SQL procedure successfully completed.
SQL> edit
Wrote file afiedt.buf
1 declare
2 begin
3 dbms_output.put_line('result='||'&a'||:a);
4* end;
SQL> /
Enter value for a: i love u
old 3: dbms_output.put_line('result='||'&a'||:a);
new 3: dbms_output.put_line('result='||'i love u'||:a);
result=i love u123
PL/SQL procedure successfully completed.
SQL>
Ïà¹ØÎĵµ£º
Microsoft SQL Server£¨ÒÔϼò³ÆSQL Server£©×÷ΪһÖÖÖÐСÐÍÊý¾Ý¿â¹ÜÀíϵͳ£¬ÒѾµÃµ½Á˹㷺µÄÓ¦Ó㬸Ãϵͳ¸üÇ¿µ÷ÓÉϵͳÀ´¹ÜÀíËø¡£ÔÚÓû§ÓÐSQLÇëÇóʱ£¬ÏµÍ³·ÖÎöÇëÇó£¬×Ô¶¯ÔÚÂú×ãËø¶¨Ìõ¼þºÍϵͳÐÔÄÜÖ®¼äΪÊý¾Ý¿â¼ÓÉÏÊʵ±µÄËø£¬Í¬Ê±ÏµÍ³ÔÚÔËÐÐÆÚ¼ä³£³£×Ô¶¯½øÐÐÓÅ»¯´¦Àí£¬ÊµÐж¯Ì¬¼ÓËø¡£
¡¡¡¡¶ÔÓÚÒ»°ãµÄÓû§¶øÑÔ£¬Í¨¹ýϵͳµÄ× ......
ϱí˵Ã÷ÔÚ Microsoft SQL Server Êý¾Ý¿âÖж¨ÒåµÄ£¬»òÔÚ Transact-SQL
Óï¾äÖÐÒýÓõĸ÷ÖÖ¶ÔÏóµÄ×î´óÖµ£¨ÊýÁ¿»ò´óС£©¡£ÏÂ±í²»°üº¬ Microsoft® SQL Server 2000™ Windows® CE °æ¡£
×î´óÖµ£¨ÊýÁ¿»ò´óС£©
¶ÔÏó
SQL Server 7.0
SQL Server 2000
Åú´¦Àí´óС
65,536 * ÍøÂçÊý¾Ý°ü´óС1
65,536 * Í ......
and exists (select * from sysobjects) //ÅжÏÊÇ·ñÊÇMSSQL
and exists(select * from tableName) //ÅжÏij±íÊÇ·ñ´æÔÚ..tableNameΪ±íÃû
and 1=(select @@VERSION) //MSSQL°æ±¾
And 1=(select db_name()) //µ±Ç°Êý¾Ý¿âÃû
and 1=(select @@servername) //±¾µØ·þÎñÃû
and 1=(select IS_SRVROLEMEMBER('sysadmin')) //Å ......