I have a procedure to loop through records from one table with a cursor then initate a insert statement into another table.
I am receiving this error in the If Statement != ALL
Begin
If V_Item = V_Item_G
And V_New_Part Is Null
And (V_Delete_G Is Null or V_Delete_G != 'Y')
And Status_G != ALL ('KNOWN', 'NEW', 'UNKNOWN', 'SOLD')
THEN INSERT INTO PART
VALUES ( V_Item, V_New_Part);
End IF;
End;
Note that NOT IN does not work.
Using not in does not insert any values. When I manually troubleshoot, != ALL or != Any return the correct values I need to insert from a select statement, but when I use NOT IN inside the statement it does not insert the correct values. If I comment out that line and execute the procedure it returns most of the correct values.
Not In ('KNOWN', 'NEW', 'UNKNOWN', 'SOLD')
--Does not work
Do this…
…using the explicit approach first:
You can also do this:
If that still(very explicit conditions) doesn’t insert correct values, the error in your code is not on that line. Look on the other conditions of your IF statement, or perhaps your data
OR PERHAPS
The variable Status_G has a typo? please debug print the value of Status_G