DBMS_SQL problem

From: Zhao Fu <scip6125_at_leonis.nus.edu.sg>
Date: 1 Jul 1999 22:51:09 GMT
Message-ID: <7lgrct$6nl$1_at_nuscc.nus.edu.sg>



Hi,

[Quoted] [Quoted] I am writing a button trigger in Form45 using DBMS_SQL package to execute [Quoted] a dynamic SQL query. The query is like:

[Quoted] select v_column_name from v_table_name; where v_column_name and [Quoted] v_table_name are form variables.

I suppose the value retrieved from v_column_name is varchar2(n),

[Quoted] It seems that I can do it in this way:

declare
v_column_name varchar2(30);
...

DBMS_SQL.PARSE(cur,'select '||v_column_name||' from '||v_table_name,
DBMS_SQL.V7)
DBMS_SQL.DEFINE_COLUMN(cur,1,v_column_name);
...

[Quoted] I met some strange problems while I was trying to compile the code:

DBMS_SQL.PARSE(cur,'select '||v_column_name||' from '||v_table_name, DBMS_SQL.V7)
[Quoted] --error1: component 'V7' must be declared

DBMS_SQL.DEFINE_COLUMN(cur,1,v_column_name);
--error2: too many declaration of 'DEFINE_COLUN' match this call

[Quoted] For error1, I enclose DBMS_SQL.V7 in the quotation mark as 'DBMS_SQL.V7', [Quoted] or replace it using a number e.g. 1, the error disappear.

[Quoted] [Quoted] For error2, I re-define the v_column_name with DATE or NUMBER type, the [Quoted] error also disappear. But for the VARCHAR2 type, I cannot find the [Quoted] solution. I tried to use DBMS_SQL.DEFINE_COLUMN_CHAR(cur,1,v_column_name) [Quoted] [Quoted] as some sample code teach me, but my compiler shows the error msg: [Quoted] component 'DEFINE_COLUMN_CHAR' must be declared.

[Quoted] Would anyone point out my problems in doing this task?

Thank you in advance.

Zhao Fu,
[Quoted] National University of Singapore Received on Fri Jul 02 1999 - 00:51:09 CEST

Original text of this message