Home » SQL & PL/SQL » SQL & PL/SQL » how to select from a ROWTYPE variable
how to select from a ROWTYPE variable [message #192573] Tue, 12 September 2006 21:32 Go to next message
piscesfly
Messages: 2
Registered: August 2006
Junior Member
I have a function to return rowtype,now i need to use a single SELECT statement use this function's return value,please help me!
Re: how to select from a ROWTYPE variable [message #192648 is a reply to message #192573] Wed, 13 September 2006 02:44 Go to previous messageGo to next message
rleishman
Messages: 3724
Registered: October 2005
Location: Melbourne, Australia
Senior Member
%ROWTYPE is a PL/SQL construction, so (pretty sure, but not 100%) it can only be used in PL/SQL statements, not SQL statements. To use the function in a SQL statement you would have to return a database TYPE (ie. one created with CREATE OR REPLACE TYPE statement).

The only way (I can think of) to use your function is:
DECLARE
  myrow mytab%ROWTYPE;
BEGIN
  myrow := myfunc(...);

  SELECT myrow.col1, myrow.col2
  FROM   DUAL
  WHERE  myrow.col3 > 1
  ... whatever ... ;
END;


Ross Leishman
Re: how to select from a ROWTYPE variable [message #192680 is a reply to message #192648] Wed, 13 September 2006 04:26 Go to previous message
piscesfly
Messages: 2
Registered: August 2006
Junior Member
thanks.I modify the function to return a string.
Previous Topic: using analytic function
Next Topic: Timeout occured while trying to LOCK object
Goto Forum:
  


Current Time: Fri Dec 09 09:44:16 CST 2016

Total time taken to generate the page: 0.14560 seconds