Re: Problem with CHAR() variable throwing INT error in CURSOR in Stored Procedure
Date: May 07, 2010 09:28PM
Well a = the collection_id & b is the criteria statement. So when I run a single instance of the statement (without the INSERT clause) i have two columns, the second of which is 'collection_id' that is set to the value of a , so with a single instance of sample data such as:
SELECT T1.sku, '91' collection_id FROM documents AS T1 WHERE T1.SDO = 'AWS' AND T1.sku NOT IN
(SELECT T2.sku FROM collections_to_docs AS T2 WHERE T2.collection_id = '91')
this is the table that ends up going into the INSERT clause:
################
# sku # collection_id'#
################
#'AWS ARE-04' # '91' #
#'AWS ARE-05' # '91' #
#'AWS a1.1' # '91' #
#'AWS A10.1M:2007' # '91' #
#'AWS a2.4-98' # '91' #
################
And if I run a single instance in the query browser then it populates the documents as I intend:
INSERT INTO collections_to_docs (sku,collection_id)
SELECT T1.sku, '91' collection_id FROM documents AS T1 WHERE T1.SDO = 'AWS' AND T1.sku NOT IN
(SELECT T2.sku FROM collections_to_docs AS T2 WHERE T2.collection_id = '91')
I just can't get a stored procedure to correctly loop the generalized statement using a repeated fetch through a cursor. :-(
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.