Ben
Ben

Reputation: 92

How to use substitution variables in Oracle APEX

I've tried everything I can find on the internet but something's just not working. I've heard that you can use substitution variables in Oracle APEX SQL Workshop by putting a string that starts with an ampersand like so: SELECT * FROM orders WHERE shipstate = '&state';, and it will ask you what you want to put as that string when you run the code. I cannot make this happen. I believe when I run the code, it is just treating the '&state' like a regular string. How do I make it treat it as a substitution string? I've already tried removing the single quotes, adding a period to the end, and a combination of both. This is in Oracle APEX workspace:

Oracle APEX

Upvotes: 1

Views: 2450

Answers (1)

Littlefoot
Littlefoot

Reputation: 143103

If bind (instead of substitution) variable is OK to you, use it.

select * from orders where shipstate = :state;

It will prompt you for state value.

Upvotes: 1

Related Questions