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

Home -> Community -> Usenet -> c.d.o.server -> Re: Concatenating FROM clause

Re: Concatenating FROM clause

From: <b_arlt_at_my-deja.com>
Date: Wed, 17 Jan 2001 04:52:29 GMT
Message-ID: <9438eb$3i6$1@nnrp1.deja.com>

In article <943631$1ml$1_at_nnrp1.deja.com>,   NEO <sneo_at_my-deja.com> wrote:
> I have a need to combine the FROM and WHERE clauses from one SQL into
 a
> new SQL that I am generating in my trigger. I am having some
> difficulty performing the concatenation. Essentially, I am trying to
 do
> the following:
> ...
> sTmp := ' TABLEA A, TABLEB B WHERE A.COL5 = B.COL6;'
> ...
> INSERT INTO MYTABLE SELECT MY_ALIAS.COL1 FROM TABLEA MY_ALIAS, || sTmp
>
> Is it possible to do such concatenations or is there a better approach
> for this task?
>
> Thanks.
>
> Sent via Deja.com
> http://www.deja.com/
>

The DBMS_SQL package allows for dynamic SQL of this type; however, I would highly recommend reviewing your query/data-model requirements to remove any dynamic sql if at all possible. Most problems can be resolved with static SQL.

It is good practice to simplify complex statements, like this; particularly within a trigger. This kind of query can make future problems a nightmare to identify, debug and resolve.

If you post a description of the query that you are using to generate the 'from' clause, and an overview of the requirements that are leading you to use this query, I would be happy to (try to :-) give you a hand simplifying this query.

-Brian

Sent via Deja.com
http://www.deja.com/ Received on Tue Jan 16 2001 - 22:52:29 CST

Original text of this message

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