PL/SQL ÖеÄSQLÓï¾ä
ÀýÈ磺
ÆÕ±éµÄSQLÓï¾ä£º
update book set bookname='sssss' where bookId=1;
ÔÚPL/SQL ÖÐÖ´ÐУº
declare
v_bookId number;
begin
v_bookId :=1;
update book set bookname='sssss' where bookId=v_bookId;
end;
1£¬select
ÔÚPL/SQL ³ÌÐòÖУ¬Ê¹ÓÃselect ...into Óï¾ä²éѯһ¸ö¼Ç¼µÄÐÅÏ¢£¬ÆäÓ﷨Ϊ£º
select select_list_item into variable_list | record_variable from table where condition;
ÀýÈ磺¸ù¾ÝÊéÃû»òÊéºÅ²éÕÒÊéµÄÐÅÏ¢¡£
declare
v_bookId book.bookId%type;
v_bookname book.bookname%type;
v_table book%rowtype;
begin
select * into v_table from book where bookId=1;
Dbms_Output.put_line('v_table.bookId '|| v_table.bookId || ' v_table.bookName ' || v_table.bookName);
select bookId,bookName into v_bookId,v_bookname from book where bookId=1;
Dbms_Output.put_line('v_bookId '|| v_bookId || ' v_bookname ' || v_bookname);
end;
×¢Ò⣺
select ...intoÓï¾äÖ»Äܲéѯһ¸ö¼Ç¼µÄÐÅÏ¢£¬Èç¹ûûÓвéѯµ½ÈκÎÊý¾Ý£¬»á²úÉúNO_DATA_FOUNDÒì³££»Èç¹û²éѯµ½¶àÌõ¼Ç¼£¬Ôò»á²úÉúTOO_MANY_ROWÒì³£¡£
into ¾ä×ÓºóµÄ±äÁ¿ÓÃÓÚ½ÓÊÕ²éѯµÄ½á¹û£¬±äÁ¿µÄ¸öÊý£¬Ë
Ïà¹ØÎĵµ£º
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER PROCEDURE [dbo].[sp_GetRecordfromPage]
@TableName varchar(350), --±íÃû
@Fields varchar(5000) = '*', --×Ö¶ÎÃû(È«²¿×Ö¶ÎΪ*)
@OrderField varchar(5000), &nbs ......
1£ºµ± SQL Óï¾äÒýÓ÷ÇË÷ÒýÊÓͼʱ£¬·ÖÎöÆ÷ºÍ²éѯÓÅ»¯Æ÷½«·ÖÎö SQL Óï¾äµÄÔ´ºÍÊÓͼµÄÔ´£¬È»ºó½«ËüÃǽâÎöΪµ¥¸öÖ´Ðмƻ®¡£Ã»Óе¥¶ÀÓÃÓÚ SQL Óï¾ä»òÊÓͼµÄ¼Æ»®¡£
2£ºË÷ÒýÊÓͼµÄÐÐÒÔ±íµÄ¸ñʽ´æ´¢ÔÚÊý¾Ý¿âÖС£Èç¹û²éѯÓÅ»¯Æ÷¾ö¶¨Ê¹Óòéѯ¼Æ»®µÄË÷ÒýÊÓͼ£¬ÔòË÷ÒýÊÓͼ½«°´ÕÕ»ù±íµÄ´¦Àí·½Ê½½øÐд¦Àí ......
bigint ´Ó -2^63 (-9223372036854775808) µ½ 2^63-1 (9223372036854775807) µÄÕûÐÍÊý¾Ý£¨ËùÓÐÊý×Ö£©¡£´æ´¢´óСΪ 8 ¸ö×Ö½Ú¡£ Int64
int ´Ó -2^31 (-2,147,483,648) µ½ 2^31 - 1 (2,147,483,647) µÄÕûÐÍÊý¾Ý£¨ËùÓÐÊý×Ö£©¡£´æ´¢´óСΪ 4 ¸ö×Ö½Ú¡£int µÄ SQL-92 ͬÒå×ÖΪ integer¡£ Int32
smallint ´Ó -2^15 (-32,768) µ½ ......
NO.1
alter table pdt modify("PDTNAME",varchar2(100))
NO.2
×ֶβ»ÓÓ”
alter table pdt modify(PDTNAME,varchar2(100)) &n ......
1.sqlÊÇÒ»Öֽű¾ÓïÑÔ
2.sql¿Éд½Å±¾³ÌÐò£¬µ«×îÖØÒªµÄ×÷Ó÷¢»ÓÔÚ¶ÔÊý¾Ý¿âµÄ²Ù×÷ÉÏ
3.sql server2005ÖеÄ×¢ÊÍÓÐÁ½ÖÖ/***/¶àÐÐ×¢ÊÍ£¬--¿ÉÒÔµ¥ÐÐ×¢ÊÍ
4.sqlÖеÄ×Ô¶¨Òå±äÁ¿ÒÔ@¿ªÍ·£¬ÏµÍ³±äÁ¿ÒÔ@@¿ªÍ·
5.sqlÖÐÉùÃ÷±äÁ¿ºÍVBÀàËÆ£¬Ê¹ÓÃdeclareÉùÃ÷±äÁ¿È磺declare @i int,@j int£¬´ËÓï¾äÉùÃ÷ÁË2¸öÕûÐαäÁ¿@iºÍ@j
6.sqlÖеÄÊý¾Ý ......