I am trying to use the vs2008
query builder to create a query with a parameter
.
I know that in sql server
it would work with:
select col1,col2
from tbl
where col3=@myParam
How would it be typed in oracle or is it pl/sql
?
I get the problem in the @myParam
part.
Parameters are defined at the beginning of a query using a declare statement. Declare statements start with the keyword DECLARE , followed by the name of the parameter (starting with a question mark) followed by the type of the parameter and an optional default value.
SQL queries with parameters, also known as SQL templates, are a flexible and efficient solution for repetitive data reporting requirements, for instance allowing users to easily execute complex join statements with multiple sets of values.
Use the double-ampersand (&&) if you want to reuse the variable value vvithout prompting the user each time. 14 rows selected. You can use the double-ampersand (&&) substitution variable if you want to reuse the variable value without prompting the user each time. The user vill see the prompt for the value only once.
V$PARAMETER displays information about the initialization parameters that are currently in effect for the session. A new session inherits parameter values from the instance-wide values displayed by the V$SYSTEM_PARAMETER view. Column. Datatype.
Oracle SQL parameters
are specified using :
SELECT col1, col2 FROM tbl WHERE col3=:myParam
You will have to be careful when specifying this as an OracleParameter
though, as some libraries miss off the :
, and some require it to bind correctly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With