A bind variable is an unspecified value (in other words, a placeholder) in a prepared database statement/command. The actual values of the bind variable is to be assigned when the statement or command is executed.
Questions tagged [bind-variables]
147 questions
3
votes
1 answer
Using cx_Oracle with an IN statement (Python 3)
I am trying to pass in parameters into a SQL "IN" statement using cx_Oracle. This gives the correct result:
sql = """select * from
(select level numb from dual connect by level <= 4)
where numb = :var"""
print([row[0] for row in…

ETLJ
- 123
- 1
- 8
3
votes
5 answers
sqlplus - using a bind variable in "IN" clause
I am setting a bind variable in a PL/SQL block, and I'm trying to use it in another query's IN expression. Something like this:
variable x varchar2(255)
declare
x varchar2(100);
begin
for r in (select id from other_table where abc in…

FrustratedWithFormsDesigner
- 26,726
- 31
- 139
- 202
3
votes
2 answers
ExecuteReader with Oracle array binding
I'm trying to improve performance of my Oracle SQL queries by using array binding to an OracleParameter.
This is basically what I'm trying to do:
List IDValList = new List();
IDValList.Add( "IDOne"…

MonkeyWrench
- 1,809
- 2
- 24
- 48
3
votes
1 answer
Oracle SQL trace with bind variables
How to aquire the full SQL statement with bind variables substituted from a trace file?
When setting
ALTER SESSION SET EVENTS '10046 trace name context forever, level 4';
ALTER SESSION SET sql_trace = true;
the resulting trace file contains the SQL…

gabor
- 1,030
- 3
- 12
- 23
3
votes
1 answer
Oracle in C#, bind variables, and queries like ID IN (1, 2, 3)
I'm looking for a C# ODAC adaptation of the following Java technique, where code is able to bind an array of numbers (the array size can vary) into a non-PL/SQL SELECT statement and then use the resulting array in a WHERE ID IN (...) style…

StilesCrisis
- 15,972
- 4
- 39
- 62
3
votes
1 answer
Perl DBI - binding a list
How do I bind a variable to a SQL set for an IN query in Perl DBI?
Example:
my @nature = ('TYPE1','TYPE2'); # This is normally populated from elsewhere
my $qh = $dbh->prepare(
"SELECT count(ref_no) FROM fm_fault WHERE nature IN ?"
) ||…

Gert van den Berg
- 2,448
- 31
- 41
3
votes
2 answers
Should I COMMIT after every execute batch?
I have a 1 trillion records file. Batch size is 1000 after which the batch is Executed.
Should I commit after each Batch ? Or Commit just once after all the 1 trillion records are executed in Batches of 1000 ?
{
// Loop for 1 Trillion…

Noman K
- 277
- 1
- 5
- 15
3
votes
1 answer
"Escape" Bind Variable ? in JDBC SQL search
So I am coding in Java, using JDBC with SQL to get data from a database. I cannot chnage the data or the column names in the database. Everything worked perfectly until I was told today that another column of the database was needed.
So I tried to…

Programming Cat
- 65
- 1
- 7
3
votes
2 answers
TOAD thinks &String as bind variable
I am developing some ETL with Oracle Data Integrator and sometimes test parts of my code by TOAD. Today I had a problem with TOAD I had a line like
AND column_value like('DEV&PROD')
when I tried to run the SQL which includes filter above, TOAD ask…

Canburak Tümer
- 993
- 17
- 36
3
votes
1 answer
jooq issue with limit and offset
I have integrated jooq with spring and for all types of querying to the database (MySQL), I am using JDBC Template of spring. jooq library is used here to generate the sql query to pass to jdbc template.
Though my rest of the query works fine until…

Rahul Shelke
- 2,052
- 4
- 28
- 50
2
votes
4 answers
Mixing Bind Variables with Literals in Oracle
This question may be better suited for the DB stackexchange site, but I wasn't sure.
Anyway, I'm dealing with optimizing queries, and I learned that using bind variables makes the parser not work as hard. We have seen improvements in the queries…

Andy
- 8,749
- 5
- 34
- 59
2
votes
2 answers
PL/SQL code using :1, :2, :3 and so on
What is the meaning of this code and what do you call this method?
How will I know what is the value for :1, :2, :3 and so on?
(PL/SQL Procedure)
UPDATE tablename
SET column = :1, column = :2, column = :3, column = :4, column= :5....

mysticfalls
- 445
- 5
- 17
- 28
2
votes
5 answers
Trying to pass parameter as binding variable in snowflake statement
Below is my stored procedure, I'm not sure as to why it keeps throwing an error. The error I get is
SQL compilation error: syntax error line XX at position XX unexpected '?'.
I have followed the documentation here but it does not seem to work for…

Addi
- 21
- 1
- 1
- 2
2
votes
0 answers
SQL*Plus: Providing values of bind variables at run time like in Toad/SQL-Developer
Dear Techies,
Our application triggers queries like below very frequently.
select name,emp_id,prod_id,prod_name, .... from appuser.table where emp_id=:1 and prod_id=:2;
We usually spend ample amount of time finding the SQL_ID when we receive the…

Mubasheer Ahmed
- 71
- 2
2
votes
1 answer
How to bind variable in string in SQL query?
I am using SQL Developer. When I want to bind value. Normally I use following syntax:
SELECT * FROM table WHERE column = :bindvalue
but, I don't know how to do that in string. The following query does not work.
SELECT * FROM table WHERE…

Mozgawa
- 115
- 9