oracle sqldeveloper - correct usage of Substitution variable in SQL Developer -


my question on usage of substitute variable in sql developer.

select &c1, &c2 x &c1 = 'abc123' , &c2 = 9999;

i wanted above statement ask inputs on c1 , c2 once , substitute values 2 times. asks me 4 times c1, c2 , again c1 , c2.

also, can't understand difference between & , &&. if have &c3, &c4...etc.

thanks

here's nice link explains difference between & , &&: orafaq

basically & asks every time , && asks once.

what want instead of substitution variables bind variables. prefix variable names colon : , should want. bind variables have added benefit of being typed can specifiy if it's string, number, date, etc. subsitution variables text inserted sql have wrap in single quotes make string (ex: '&foo' vs :foo bind variable).

example:

select :foo x      , :bar y      , some_column my_table some_other_column = :foo 

Comments