日期:2014-05-17 浏览次数:20882 次
CREATE TABLE CODE_TABLE
(CODE VARCHAR2(50),
VALUEDEF VARCHAR2(100)
);
INSERT INTO CODE_TABLE VALUES('061-00','TRUNC(SYS.DBMS_RANDOM.VALUE(1400,1500), 0)');
COMMIT;
DECLARE
vSQL VARCHAR2(1000);
vValuedef VARCHAR2(100);
vResult NUMBER;
BEGIN
SELECT VALUEDEF
INTO vValuedef
FROM CODE_TABLE
WHERE CODE = '061-00';
vSQL := 'SELECT '
------解决方案--------------------
vValuedef
------解决方案--------------------
' FROM DUAL';
EXECUTE IMMEDIATE vSQL INTO vResult;
DBMS_OUTPUT.PUT_LINE(vResult);
EXCEPTION
WHEN NO_DATA_FOUND THEN
NULL;
WHEN TOO_MANY_ROWS THEN
NULL;
END;