substitution variables - SQL in TOAD

I have a big SQL query with 3 substitution variables, a manager name. Is there a way to fix the query, so I don’t have to pass the SAME user_mgr name “Chris Howard” 3 times?

Query something like this…

select …

where I.USER_TYPE = ‘Employee’ AND USER_MGR =’&USER_MGR’)

UNION ALL

where i.USER_TYPE = ‘Employee’ AND USER_MGR =’&USER_MGR’

UNION ALL

select …

whreer i.USER_TYPE = ‘Employee’ AND USER_MGR =’&USER_MGR’)

Yes

Use two ampersands instead of one. For example, change all of the '&USER_MGR' to '&&USER_MGR'

On Sat, Jul 7, 2018 at 8:38 AM, RAMESH.UDVADIA bounce-RAMESHUDVADIA@toadworld.com wrote:

substitution variables - SQL in TOAD

Thread created by RAMESH.UDVADIA
I have a big SQL query with 3 substitution variables, a manager name. Is there a way to fix the query, so I don't have to pass the SAME user_mgr name "Chris Howard" 3 times?

Query something like this...

select ......

where I.USER_TYPE = 'Employee' AND USER_MGR ='&USER_MGR')

UNION ALL

where i.USER_TYPE = 'Employee' AND USER_MGR ='&USER_MGR'

UNION ALL

select ....

whreer i.USER_TYPE = 'Employee' AND USER_MGR ='&USER_MGR')

To reply, please reply-all to this email.

Stop receiving emails on this subject.

Or Unsubscribe from Toad for Oracle Forum notifications altogether.

Toad for Oracle - Discussion Forum

Flag this post as spam/abuse.

--
Gene L. Bradley Jr.

Systems Analyst

Office of Information Technology

Jackson State University

1400 J R Lynch Street

P.O. Box 17750

Jackson, MS 39217

ph 601.979.1042

fax 601.371.9146

email gbradley@jsums.edu

*In God we trust; all others bring data. * ~W.E. Deming

CONFIDENTIALITY STATEMENT

This electronic transmission is intended for the use of the individual or entity to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by telephone (601) 979-1042. Thank you.