Toad World® Forums

Editor - execute as script not returning correct value


#1

The code below is not working at expected when run in Editor via Execute as Script. Works correctly in SQL*Plus. In the last section, the _environment variable is retaining its previous value and is not being set to ‘’ as it should be.

DEFINE CURRENT_SCHEMA=FIRM_COMM
SET DEFINE ON
COLUMN xx new_value _environment noprint
SELECT CASE WHEN UPPER(’&&current_schema’) = ‘FIRM_COMM’ THEN ‘_FC’
ELSE ‘’
END xx
FROM dual;

SELECT ‘&&_environment’ FROM dual;

DEFINE CURRENT_SCHEMA=REFERENCE
SET DEFINE ON
COLUMN xx new_value _environment noprint
SELECT CASE WHEN UPPER(’&&current_schema’) = ‘FIRM_COMM’ THEN ‘_FC’
ELSE ‘’
END xx
FROM dual;

SELECT ‘&&_environment’ FROM dual;


#2

Hello,

We can reproduce this… logged

From: droeschley_109 [mailto:bounce-droeschley_109@toadworld.com]

Sent: Friday, July 24, 2015 11:08 AM

To: toadoraclebeta@toadworld.com

Subject: [Toad for Oracle - Beta Discussion Forum] Editor - execute as script not returning correct value

Editor - execute as script not returning correct value

Thread created by droeschley_109

The code below is not working at expected when run in Editor via Execute as Script. Works correctly in SQL*Plus. In the last section, the _environment variable is retaining its previous value and is not being set to ‘’ as it should be.

DEFINE CURRENT_SCHEMA=FIRM_COMM

SET DEFINE ON

COLUMN xx new_value _environment noprint

SELECT CASE WHEN UPPER(’&&current_schema’) = ‘FIRM_COMM’ THEN ‘_FC’

ELSE ‘’

END xx

FROM dual;

SELECT ‘&&_environment’ FROM dual;

DEFINE CURRENT_SCHEMA=REFERENCE

SET DEFINE ON

COLUMN xx new_value _environment noprint

SELECT CASE WHEN UPPER(’&&current_schema’) = ‘FIRM_COMM’ THEN ‘_FC’

ELSE ‘’

END xx

FROM dual;

SELECT ‘&&_environment’ FROM dual;

To reply, please reply-all to this email.

Stop receiving emails on this subject.

Or
Unsubscribe from Toad for Oracle - Beta
notifications altogether.

Toad for Oracle - Beta Discussion Forum

Flag
this post as spam/abuse.