Oracle Magazine, May/June 2018
Database Developer OPEN SOURCE cur execute select id name age notes from cx_ people where name 2 and age 1 Bob 35 Note that the 1 and the 2 are switched in the two examples With a positional statement the labels do not matter it could just as well have been 1 and something What matters is that the first variable in the statement will be assigned the first of the provided values Bob and the second variable in the statement will be assigned the second value 35 Named You can use a statement that passes in the values by name cur execute select id name age notes from cx_ people where name name and age age name Bob age 35 cur execute select id name age notes from cx_ people where name name and age age age 35 name Bob With this method the name variable will be assigned the value of name in the provided key value set Note in both examples that you do not wrap the bind variable for name with quotes This is handled automatically when the statement is prepared for execution Heres an example that passes in values by name Query for Kim cur con cursor person_ name Kim statement select id name age notes from cx_ people where name name ORACLE MAGAZINE MAY JUNE 2018 85
You must have JavaScript enabled to view digital editions.