CREATE TABLE TEST_CASE
(
ID NUMBER(19,2),
CURRENCY_TYPE VARCHAR2(30),
PAIDAMT NUMBER(19,2),
RECVDAMT NUMBER(19,2),
AMTDUE NUMBER,
TRANSACTION_DATE VARCHAR2(30)
);
我创建了一个程序来获取名称中包含AMT的字段。但是程序在执行时显示错误,我不知道为什么会产生这个错误。
create or replace procedure chk_amt
(
vtbl varchar2
)
as
tblcursor sys_refcursor;
tblsqlstr varchar2(1000);
importedrows VARCHAR2(1000);
BEGIN
tblsqlstr := 'Select COLUMN_NAME from user_tab_columns where table_name= '|| vtbl ||' and COLUMN_NAME like upper(''%AMT%'')' ;
OPEN tblcursor for tblsqlstr;
loop
fetch tblcursor into importedrows;
DBMS_OUTPUT.PUT_LINE(importedrows);
EXIT WHEN tblcursor%NOTFOUND;
end loop;
CLOSE tblcursor;
end;
/
错误是
ORA-00904: "TEST_CASE": invalid identifier
ORA-06512: at "***.CHK_AMT", line 11
ORA-06512: at line 2
我该如何解决这个错误?