Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Pl/SQL Dynamic SQL questions

Pl/SQL Dynamic SQL questions

From: Susan E Teague <Susan_at_fileFRENZY.com>
Date: Tue, 06 Feb 2001 13:27:59 -0800
Message-ID: <F001.002ACB08.20010206131738@fatcity.com>

Hello all,
Okay, so I may be making this problem more difficult than it appears, but I'm having a helluva time using ref cursors with dynamic sql in a function. Anybody done this? Basically I'm trying to construct the select, from and where clauses via variables; so for instance, I test for acctType (passed in as a parameter) like so:
if (acctType = 0) then
selectClause := 'select etc.';
elsif (accType = 1) then
selectClause := 'select etc.';
etc. etc.

Then I have one big sqlStmt variable where I concat the select, from, where clause.
I open the sqlStmt, fetch into a programmer defined record and try and return this cursor. Problem is sql*plus locks up each time I try to run it. I never get anything back which leads me to believe that something is terribly wrong with my approach. I've used an approach outlined in the Oracle documentation...

Thanks for you help! Hope this makes sense :)

SE Teague
Aresenal Digital Solutions
Data Services
susan_at_filefrenzy.com
919.760.1167

--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author: Susan E Teague
  INET: Susan_at_fileFRENZY.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Tue Feb 06 2001 - 15:27:59 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US