Skip to Main Content

Database Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SQL*Plus built-in DEFINE variable to indicate OS platform

William RobertsonFeb 26 2016 — edited Jan 19 2020

This may be a tiny thing next to adding a Boolean type to the SQL language etc, but it would be really useful for writing portable SQL*Plus scripts if there was a built-in underscore variable (similar to _SQLPLUS_RELEASE etc) indicating the base platform of the SQL*Plus executable. (Or the invoking shell program e.g. cmd.exe, bash etc, although I can see that would take more effort than essentially a constant string that Oracle could include in each branch when compiling.)

As it is, if we want to have a SQL*Plus script delete a temp file (for example), we have to use elaborate workarounds like checking for slash characters in sys_context('userenv','host') and sys_context('userenv','terminal') or a .exe extension in  sys_context('userenv','client_program_name') or v$session.program for the current session, in order to decide whether to use del or rm.

Comments

Post Details

Added on Feb 26 2016
3 comments
486 views