代码如下:
declare :dcidnum number(20)
begin
insert into DATACHANGE(CTYPE,USERID,CROW,CONDCID,CTABLE,CSTATE,CTIME) values('1','001',0,-1,'','1',to_date('2012-4-11 17:26:39','yyyy-mm-dd hh24:mi:ss'));
:dcidnum=select DCID from DATACHANGE where CTIME= to_date('2012-4-11 17:26:39','yyyy-mm-dd hh24:mi:ss');
select :dcidnum;
end
拜托各位大神解析...
------解决方案--------------------
语法不正确
- SQL code
VARIABLE dcidnum numberbegininsert into DATACHANGE(CTYPE,USERID,CROW,CONDCID,CTABLE,CSTATE,CTIME) values('1','001',0,-1,'','1',to_date('2012-4-11 17:26:39','yyyy-mm-dd hh24:mi:ss')); select DCID INTO :dcidnum from DATACHANGE where CTIME= to_date('2012-4-11 17:26:39','yyyy-mm-dd hh24:mi:ss');end;/print dcidnum
------解决方案--------------------
请参考:
- SQL code
DECLARE dcidnum NUMBER(20);BEGIN INSERT INTO DATACHANGE(CTYPE,USERID,CROW,CONDCID,CTABLE,CSTATE,CTIME) VALUES('1','001',0,-1,'','1',to_date('2012-4-11 17:26:39','yyyy-mm-dd hh24:mi:ss')); SELECT DCID INTO dcidnum FROM DATACHANGE WHERE CTIME= to_date('2012-4-11 17:26:39','yyyy-mm-dd hh24:mi:ss'); DBMS_OUTPUT.PUT_LINE(dcidnum);END;