Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7895511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:39:41+00:00 2026-06-03T07:39:41+00:00

I have a procedure to loop through records from one table with a cursor

  • 0

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
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T07:39:42+00:00Added an answer on June 3, 2026 at 7:39 am

    Do this…

    And Status_G != ALL  ('KNOWN', 'NEW', 'UNKNOWN', 'SOLD')
    

    …using the explicit approach first:

    And 
    (Status_G <> 'KNOWN' AND Status_G <> 'NEW' 
    AND Status_G <> 'UNKNOWN' AND Status_G <> 'SOLD')
    

    You can also do this:

    And 
    NOT (Status_G = 'KNOWN' OR Status_G = 'NEW' 
    OR Status_G = 'UNKNOWN' OR Status_G = 'SOLD')
    

    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

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a list of values I want to insert into a table via
I have a stored procedure called sp_BulkInsert that inserts one .csv file into my
So if a language provides higher order procedure then I can have procedure that
i have a procedure in which i am inserting record in employee table.nad getting
I have this procedure that executes another procedure passed by a parameter and its
If I have a simple query like: OPEN cursor FOR SELECT USER_ID FROM USER_TABLE
Say I have this great query in my stored procedure. Select * from Temp
I have written a package that has a stored procedure and a REF cursor.
I have a stored procedure that i thought was caught in an infinite loop,
My requirement like this: I have to fetch a row from table A. Now

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.