Re: Using unload in a store procedure
Posted in 1997
Topics: Stored Procedures & SPL, Server Administration, Migration, Import/Export & Data Conversion
Laam Wong wrote:
> 1) My question is, can I use unload inside a store procedure?
No, you can't as you have discovered.
> 2)If not, how can I output my query result to a Unix system file with
> a given delimiter?
- - - - - - - - 8< - - - - - -
#!/bin/ksh
dbaccess mydb <<!
unload to 'myfile' delimiter '|'
select * from mytable!
- - - - - - - - 8< - - - - - -
OR more complicated processing:
- - - - - - - - 8< - - - - - -
#!/bin/ksh
dbaccess mydb <<!
create procedure fred()
-- do any normal procedure processing
select * from mytable
where someclause
into temp ttable with no log;end procedure;
execute procedure fred();
unload to 'myfile' delimiter '|'
select * from ttable;
drop table ttable;
drop procedure fred;!
- - - - - - - - 8< - - - - - -
--
Mark Fisher
DBA Britannic Assurance
------------------------------------------
The views expressed here are mine and not
those of my employer, Britannic Assurance
------------------------------------------