oracle – pl / SQL显示select语句的结果
发布时间:2021-01-14 06:14:29 所属栏目:站长百科 来源:网络整理
导读:Set ServerOutput on size 100000;declarecountTab number := 0;countCol number := 0;currDate varchar2(30);scale number := 0;Beginselect count(*) into countCol from USER_TAB_COLUMNS where TABLE_NAME = 'EVAPP_INTERFACE' and COLUMN_NAME = 'TARGE
Set ServerOutput on size 100000; declare countTab number := 0; countCol number := 0; currDate varchar2(30); scale number := 0; Begin select count(*) into countCol from USER_TAB_COLUMNS where TABLE_NAME = 'EVAPP_INTERFACE' and COLUMN_NAME = 'TARGET_AMNT_LTV_NUM' and DATA_SCALE is null; IF (countCol <> 0) then DBMS_OUTPUT.put_line(' EVAPP_INTERFACE.TARGET_AMNT_LTV_NUM values begin'); execute immediate 'select APPSEQNO,TARGET_AMNT_LTV_NUM from evapp_interface where TARGET_AMNT_LTV_NUM > 999999999999'; END IF; END; 我试图表现选择查询的功效.我实行按原样运行select语句,但它给出了一个破例,说它无法找到所提到的列.以是,我实行将表名放在列的前面,而且它诉苦我必要行使INTO,我也行使它,但它如故不喜好语法. 办理要领假设您正在行使SQL * Plus,最简朴的选择大噶?鲻相同的工作Set ServerOutput on size 100000; variable rc refcursor; declare countTab number := 0; countCol number := 0; currDate varchar2(30); scale number := 0; Begin select count(*) into countCol from USER_TAB_COLUMNS where TABLE_NAME = 'EVAPP_INTERFACE' and COLUMN_NAME = 'TARGET_AMNT_LTV_NUM' and DATA_SCALE is null; IF (countCol <> 0) then DBMS_OUTPUT.put_line(' EVAPP_INTERFACE.TARGET_AMNT_LTV_NUM values begin'); open :rc FOR 'select APPSEQNO,TARGET_AMNT_LTV_NUM ' || ' from evapp_interface ' || ' where TARGET_AMNT_LTV_NUM > 999999999999'; END IF; END; / PRINT rc; 假如要表现PL / SQL的功效,则必要打开游标,将功效提取到局部变量中,然后对局部变量执行某些操纵,譬喻将它们写入DBMS_OUTPUT. (编辑:湖南网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |