[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Problems with dynamic sql
Hi,
Im trying a dynamic sql proc in Oracle.The code is given below.It accepts
the following parameters
Sourcetable
Keyfields
Longfield
create or replace procedure extractdata (source in varchar2,keyfield in
varchar2,longfield in long)
IS TYPE cur_typ IS REF CURSOR;
get_rec_curr cur_typ;
get_rec_prev cur_typ;
long_curr LONG;
long_prev LONG;
len_long_curr number(10);
len_long_prev number(10);
status number(1);
val
VARCHAR2(32767);
sqlstr
varchar(1000);
BEGIN
OPEN get_rec_curr FOR
'SELECT ' || keyfield||','||longfield ||' FROM '
|| source ;<<<The problem is right here>>>
LOOP
FETCH get_rec_curr INTO VAL;
EXIT WHEN get_rec_curr%NOTFOUND;
dbms_output.put_line(val);
END LOOP;
CLOSE get_rec_curr;
END;
I want to extract long field and do some manipulation.I have the
following problems.When I execute the procedure
I get the following error
ORA-00932: inconsistent datatypes
ORA-06512: at "SYSADM.COMPARELONG", line 21
ORA-06512: at line 2
I know that the problem is because keyfield is of type varchar and
longfield has a long column.Is there a solution for the problem.
Thanks & Regards
Harish
**************************************************************************
This email (including any attachments) is intended for the sole use of the
intended recipient/s and may contain material that is CONFIDENTIAL AND
PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or
distribution or forwarding of any or all of the contents in this message is
STRICTLY PROHIBITED. If you are not the intended recipient, please contact
the sender by email and delete all copies; your cooperation in this regard
is appreciated.
**************************************************************************