Variables in Code Templates

Is there a way to optionally escape the & with an Advanced Template? In the sample below I want the prompt for &&FilePrefix. I want the SPOOL ‘&logname’ to remain as-is. I can put the &logname back in the prompt, but I’d prefer to have it automated and bullet proof.

SET VERIFY OFF
COLUMN clogname NEW_VALUE logname NOPRINT

SELECT SYS_CONTEXT (‘USERENV’, ‘INSTANCE_NAME’)
|| ‘&&FilePrefix.
|| TO_CHAR (SYSTIMESTAMP, ‘yyyymmddhh24miss’)
|| ‘.log’
clogname
FROM DUAL;

SPOOL ‘&logname

This is not possible. You will be prompted for all sub vars. You could use advanced template and replace &&FilePrefix with and before invoking the template copy your file prefix to clipboard. Not ideal, but as close as you can get I think.

On Dec 21, 2015, at 1:14 PM, chazamania bounce-chazamania@toadworld.com wrote:

Variables in Code Templates

Thread created by chazamania
Is there a way to optionally escape the & with an Advanced Template? In the sample below I want the prompt for &&FilePrefix. I want the SPOOL '&logname' to remain as-is. I can put the &logname back in the prompt, but I'd prefer to have it automated and bullet proof.

SET VERIFY OFF

COLUMN clogname NEW_VALUE logname NOPRINT

SELECT SYS_CONTEXT ('USERENV', 'INSTANCE_NAME')

  || '_**&&FilePrefix**._'

  || TO_CHAR (SYSTIMESTAMP, 'yyyymmddhh24miss')

  || '.log'

     clogname

FROM DUAL;

SPOOL '&logname'

To reply, please reply-all to this email.

Stop receiving emails on this subject.

Or
Unsubscribe from Toad for Oracle - General
notifications altogether.

Toad for Oracle - Discussion Forum

Flag
this post as spam/abuse.

Hmmm, you'll still be prompted for logname with my suggestion. This could be improved a bit.

On Dec 21, 2015, at 1:14 PM, chazamania bounce-chazamania@toadworld.com wrote:

Variables in Code Templates

Thread created by chazamania
Is there a way to optionally escape the & with an Advanced Template? In the sample below I want the prompt for &&FilePrefix. I want the SPOOL '&logname' to remain as-is. I can put the &logname back in the prompt, but I'd prefer to have it automated and bullet proof.

SET VERIFY OFF

COLUMN clogname NEW_VALUE logname NOPRINT

SELECT SYS_CONTEXT ('USERENV', 'INSTANCE_NAME')

  || '_**&&FilePrefix**._'

  || TO_CHAR (SYSTIMESTAMP, 'yyyymmddhh24miss')

  || '.log'

     clogname

FROM DUAL;

SPOOL '&logname'

To reply, please reply-all to this email.

Stop receiving emails on this subject.

Or
Unsubscribe from Toad for Oracle - General
notifications altogether.

Toad for Oracle - Discussion Forum

Flag
this post as spam/abuse.