Re: Executing stored SQL statements

From: Reginald Bailey <rwbailey_at_usa.net>
Date: 1997/07/17
Message-ID: <33CE649A.4908_at_usa.net>#1/1


Rick Musgrove wrote:
>
> Can anyone give me some suggestions as to how to retrieve SQL statements
> from a table and then execute them in a procedure and then execute them?
> I want to store rules in a table, then use them to create a relation
> between two entities.
>
> i.e. BEGIN
> update case_record set case_record.clerk_id = rules.clerk_id
> where case_record.case_record_id = :case_record_id
> and (select rule from rules);
> END;
>
> I would like to do this *without* building a procedure.sql file and then
> executing it, because I need to know if the rule was a 'hit' or not.
>
> Is there a way set a declared variable to an sql statement string and
> then execute the contents of the variable as an sql statement, updating
> other variables declared in the procedure?
>
> Rick.

Rick:

You can indeed set a variable to a SQL statement string. Is this being done in SQL*Plus, PL/SQL or Pro*C? If it is in PL/SQL, use the "EXECUTE" command to execute a dynamic SQL statement. There are ways to execute dynamic SQL statements in all three environments. If you will try to be more specific, I will try to offer the appropriate advice.

Reginald

-- 
--------------------------------------------------------------
Reginald W. Bailey
Consultant
c/o Landmark Graphics Corp.  Houston, TX 281-368-8937
rbailey_at_lgc.com
rwbailey_at_usa.net
--------------------------------------------------------------
Received on Thu Jul 17 1997 - 00:00:00 CEST

Original text of this message