Home » RDBMS Server » Server Administration » Re: executing a select statment in a package
Re: executing a select statment in a package [message #369617] Wed, 08 November 2000 05:46
Babu Paul
Messages: 38
Registered: November 2000
Member
Hi, I can see the problem here. The selected columns did not match with the columns of your main table or the activity_log table. Because the return value is declared as activity_log%ROWTYPE, the value returned should exactly match with the data types of columns in activity_log table. Also it is a must that all the columns in this table or equivalent columns(data types) from join tables are selected. Otherwise this error is bound to occur.

I hope this makes sense.. let me explain it to you with an examplet.....

Consider two tables emp and dept with
emp{ eno number(12), ename varchar2(50), dno number(12)}
dept { dno number(12), dname varchar2(50)}

your ref cursor should select 3 columns of the same data type in emp in the same order.....

ie. OPEN Com_Cur
FOR
SELECT eno, ename, a.dno
FROM emp a, dept b
WHERE a.dno = b.dno
AND a.dno = p_no ;

or

OPEN Com_Cur
FOR
SELECT eno, ename, b.dno
FROM emp a, dept b
WHERE a.dno = b.dno
AND a.dno = p_no ;

is valid........

Invalid select:
-----------------
OPEN Com_Cur
FOR
SELECT eno,ename,b.dname
FROM emp a, dept b
WHERE a.dno = b.dno
AND a.dno = p_no ;

This will raise ORACLE error PLS-00382: expression is of wrong type

Good Luck!
Babu Paul
Previous Topic: From statement
Next Topic: SQL Functions
Goto Forum:
  


Current Time: Fri May 03 15:57:24 CDT 2024