How to create mulitple stored procedures in one file via BTEQ

Tools & Utilities
Enthusiast

How to create mulitple stored procedures in one file via BTEQ

Can I create more than one stored procedure per file when submitting the file through BTEQ?
How do people create hundreds of stored procedures in batch?
Thank you!
Regards, Nancy
4 REPLIES
Enthusiast

Re: How to create mulitple stored procedures in one file via BTEQ

Hi Nancy,

Have you tried to use the BTEQ tool in batch mode?

Example:

You may execute the following command line at the OS prompt:

# bteq < test.txt

where "test.txt" is a text file created in any text editor that is able to save text files, like Wordpad from windows, with the following content:

.logon user,password
create procedure p1 .....
;
create procedure p2......
;
create procedure pn .....
;
.logoff

You may find more details on running BTEQ in batch mode or interactive mode at BTEQ manual.

I hope this helps!
Enthusiast

Re: How to create mulitple stored procedures in one file via BTEQ

I am not sure if bteq can create stored procs online.....

From my experience it always needs to be "compiled" if you are using bteq.

so if you have multiple stored procs in different ddl files like this

proc1.ddl
proc2.ddl
........

etc

then something like this is a recommended approach

bteq <<END

.logon;

.compile file = proc1.ddl;
.compile file = proc2.ddl;
........

END
Enthusiast

Re: How to create mulitple stored procedures in one file via BTEQ

oops that's again a unix syntax ... ;)

you would want to put the contents

.logon;

.compile file = proc1.ddl;
.compile file = proc2.ddl;
........

into a file call compilesps.bteq

and then do a

bteq &1

that would run the bteq file with all the compile statements and then ouput the error message to compilesps.bteq.log file
Enthusiast

Re: How to create mulitple stored procedures in one file via BTEQ

some how I can't get the redirection operators to show up in the post ..Grr...

so, well you know.... run the compilesps.bteq bteq file using bteq ;)