日期:2014-05-17 浏览次数:20853 次
VARIABLE dcidnum number 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'); end; / print dcidnum
------解决方案--------------------
请参考:
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;