Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / DB2 Topics / June 2006

Tip: Looking for answers? Try searching our database.

Dynamic SQL within Procedure - String Continuation/Builder

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
rj_noone962@hotmail.com - 29 Jun 2006 16:13 GMT
Hello,

I am trying to build a SQL statement dynamically for execution within a
procedure, using PREPARE ... OPEN.

SET v_sql = ' SELECT a,b,c,d,e, .....x,y,z FROM  table1, table2  WHERE
a = v_1...and so on   FOR READ ONLY';

What is used for continuation if I want to break the variable v_sql out
into lines so one can read it?

SET v_sql = ' SELECT a,b,c,d,e, .....x,y,z   (what goes here?)
                   FROM  table1, table2             (and here?)
                   WHERE a = v_1...and so on   (and here?)
                   FOR READ ONLY';

Thanks
Purple-D - 29 Jun 2006 17:55 GMT
You could try the concat function or ||

> Hello,
>
[quoted text clipped - 13 lines]
>
> Thanks
--CELKO-- - 30 Jun 2006 13:29 GMT
>> I am trying to build a SQL statement dynamically for execution within a procedure, ..<<

Do not write code like this.  It says that your design is so bad that a
random future stranger can do a better job at run-time that you did
with all the specs and weeks of coding.  You say that you don't know or
care about SQK injection, etc.  Justr sloppy coding

>>  What is used for continuation if I want to break the variable v_sql out into lines so one can read it? <<

Why are you worred about display instead of performance anyway?  This
is like asking a furniture newsgroup for the best rocks for smashing
screws into wood. The quick answer in "Granite!" but the right answer
is "uses a screw driver" instead.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.