Finding out your current database in SPL
Posted in 1999
Topics: Stored Procedures & SPL
Hi In my SPL I need to run a SYSTEM command that executes a batch file, which will then update the relevant database, but I cant any way of passing the current database to the system. We also have other databases which also need to execute the batch file, I have a work-around, which is to create separate procedures for each database which execute separate batch files. This isn't very tidy as the procedures files have to be kept separate for each database. Any help would be gratefully received. Software Info. INFORMIX-OnLine Version 7.20.UC5 SCO OpenServer(TM) Release 5 Wayne Sheldon Computer Manager Airflow Streamlines plc Production Division
Sheldon, Wayne wrote:
>
> Hi
>
> In my SPL I need to run a SYSTEM command that executes a batch file,
> which will then update the relevant database, but I cant any way of passing
> the current database to the system.
>
> We also have other databases which also need to execute the batch file,
>
> I have a work-around, which is to create separate procedures for each
> database which execute separate batch files.
> This isn't very tidy as the procedures files have to be kept separate for
> each database.
I assume that you cannot simply add an argument to the stored procedure
to pass the database name as an argument?! Try this query in the
stored procedure:
SELECT dbsname
FROM systables st, sysmaster:systabnames stn
WHERE st.tabid = 1
AND st.partnum = stn.partnum;
This will work as long as your current database supports Informix
logging (ie not ANSI and not UNLOGGED).
Art S. Kagel