I need to assign a select to a local variable. I already googled a lot and came to the following solution (which is not working, so it's not really a solution):
select @identId = (select ident_id FROM tablename WHERE number='0000001670');
I am getting the following error:
[SELECT - 0 row(s), 0.000 secs] [Error Code: 936, SQL State: 42000] ORA-00936: missing expression.
A SET does not do the trick either. I tried as well DEFINE, but without any success as well. I need to assign this select to a variable, because i am going to delete this table and i need the value later on. On the other hand does it reduce my code duplication.
Does it have to look something like this:
select ident_id as identId FROM zam_partnerdublette WHERE pa_nummer='0000001670';
But then I can't use the variable later. I tried:
delete from tablename where ident_id=@identId;
delete from tablename where ident_id=&identId;
delete from tablename where ident_id=identId;
But all of them resulted in different errors:
[DELETE - 0 row(s), 0.000 secs] [Error Code: 936, SQL State: 42000] ORA-00936: missing expression
[DELETE - 0 row(s), 0.000 secs] [Error Code: 1008, SQL State: 72000] ORA-01008: Not every variable has an assigned value
[DELETE - 0 row(s), 0.000 secs] [Error Code: 904, SQL State: 42000] ORA-00904: "IDENTID": unknown identifier
ORA-00936looks like an oracle error? techonthenet.com/oracle/errors/ora00936.php