montypython1
Technical User
Greetings,
Is there a maximum number of cursors that I can have open at the same time?
I am doing some lengthy calculations and decided to break up the SQL into smaller bites, but after my third cursor, I receive an error message saying:
"csr01 must be created with SELECT ... INTO TABLE"
Each of my SQL statements are sequential (please see below):
***************************************************************************
SELECT st_src01.*, st_fi.* ;
FROM st_src01 ;
LEFT OUTER JOIN st_fi ;
ON stocknum = st_fi.stocknumfi ;
ORDER BY cust_state, cust_cnty, cust_city, taxcode1, prefix, typesale_a, stocknum, refnum ;
INTO CURSOR csr01_fi_a
SELECT dealer, cust_state, cust_cnty, cust_city, taxcode1, prefix, typesale_a, stocknum, refnum, ;
jrnl_date, rev_date, namelastfi, taxcode2, taxcode3, sale_amt, ;
IIF(sale_amt>0, NVL(CapCostRed,000000.00), NVL(CapCostRed,000000.00)*-1) AS CapCostRed_calc, ;
IIF(sale_amt>0, NVL(trd_acv,000000.00), NVL(trd_acv,000000.00)*-1) AS Trd_ACV_calc, ;
IIF(sale_amt>0, NVL(trd_oa,000000.00), NVL(trd_oa,000000.00)*-1) AS Trd_OA_calc, ;
IIF(sale_amt>0, NVL(trd_ua,000000.00), NVL(trd_ua,000000.00)*-1) AS Trd_UA_calc, ;
txbl_fe01 + txbl_fe02 + txbl_fe03 + txbl_fe04 + txbl_fe05 AS Amkt_FE, ;
txbl_be01 + txbl_be02 + txbl_be03 + txbl_be04 + txbl_be05 AS Amkt_BE, ;
IIF(sale_amt>0, NVL(docfee,000000.00), NVL(docfee,000000.00)*-1) AS DocFee_calc, ;
IIF(sale_amt>0, NVL(acqfee,000000.00), NVL(acqfee,000000.00)*-1) AS AcqFee_calc, ;
taxamt1, taxamt2, taxamt3, ct, taxrate ;
FROM csr01_fi_a ;
LEFT OUTER JOIN countytaxrates ;
ON cust_cnty = countyname ;
INTO CURSOR csr01_fi_b
SELECT * , ;
IIF(sale_amt>0, NVL(Amkt_FE,000000.00), NVL(Amkt_FE,000000.00)*-1) AS Amkt_FE_calc, ;
IIF(sale_amt>0, NVL(Amkt_BE,000000.00), NVL(Amkt_BE,000000.00)*-1) AS Amkt_BE_calc, ;
Trd_ACV_calc + Trd_OA_calc - Trd_UA_calc AS MaxDeduct ;
FROM csr01_fi_b ;
INTO CURSOR csr01_fi_c
SELECT dealer, cust_state, cust_cnty, cust_city, taxcode1, prefix, typesale_a, stocknum, refnum, ;
jrnl_date, rev_date, namelastfi, taxcode2, taxcode3, sale_amt, ;
CapCostRed_calc, ;
Trd_ACV_calc, ;
Trd_OA_calc, ;
Trd_UA_calc, ;
MaxDeduct, ;
Amkt_FE_calc, ;
Amkt_BE_calc, ;
DocFee_calc, ;
AcqFee_calc, ;
taxamt1, taxamt2, taxamt3, ct, taxrate ;
FROM csr01_fi_c ;
INTO CURSOR csr01_fi_d
BROWSE
*****************************************************************
** the following generates the error: "csr01_fi_d must be created with SELECT ... INTO TABLE"
SELECT * ;
FROM csr01_fi_d ;
INTO CURSOR csrSrc01_fi_e
*****************************************************************
***************************************************************************
Any help is greatly appreciated.
Dave Higgins
Is there a maximum number of cursors that I can have open at the same time?
I am doing some lengthy calculations and decided to break up the SQL into smaller bites, but after my third cursor, I receive an error message saying:
"csr01 must be created with SELECT ... INTO TABLE"
Each of my SQL statements are sequential (please see below):
***************************************************************************
SELECT st_src01.*, st_fi.* ;
FROM st_src01 ;
LEFT OUTER JOIN st_fi ;
ON stocknum = st_fi.stocknumfi ;
ORDER BY cust_state, cust_cnty, cust_city, taxcode1, prefix, typesale_a, stocknum, refnum ;
INTO CURSOR csr01_fi_a
SELECT dealer, cust_state, cust_cnty, cust_city, taxcode1, prefix, typesale_a, stocknum, refnum, ;
jrnl_date, rev_date, namelastfi, taxcode2, taxcode3, sale_amt, ;
IIF(sale_amt>0, NVL(CapCostRed,000000.00), NVL(CapCostRed,000000.00)*-1) AS CapCostRed_calc, ;
IIF(sale_amt>0, NVL(trd_acv,000000.00), NVL(trd_acv,000000.00)*-1) AS Trd_ACV_calc, ;
IIF(sale_amt>0, NVL(trd_oa,000000.00), NVL(trd_oa,000000.00)*-1) AS Trd_OA_calc, ;
IIF(sale_amt>0, NVL(trd_ua,000000.00), NVL(trd_ua,000000.00)*-1) AS Trd_UA_calc, ;
txbl_fe01 + txbl_fe02 + txbl_fe03 + txbl_fe04 + txbl_fe05 AS Amkt_FE, ;
txbl_be01 + txbl_be02 + txbl_be03 + txbl_be04 + txbl_be05 AS Amkt_BE, ;
IIF(sale_amt>0, NVL(docfee,000000.00), NVL(docfee,000000.00)*-1) AS DocFee_calc, ;
IIF(sale_amt>0, NVL(acqfee,000000.00), NVL(acqfee,000000.00)*-1) AS AcqFee_calc, ;
taxamt1, taxamt2, taxamt3, ct, taxrate ;
FROM csr01_fi_a ;
LEFT OUTER JOIN countytaxrates ;
ON cust_cnty = countyname ;
INTO CURSOR csr01_fi_b
SELECT * , ;
IIF(sale_amt>0, NVL(Amkt_FE,000000.00), NVL(Amkt_FE,000000.00)*-1) AS Amkt_FE_calc, ;
IIF(sale_amt>0, NVL(Amkt_BE,000000.00), NVL(Amkt_BE,000000.00)*-1) AS Amkt_BE_calc, ;
Trd_ACV_calc + Trd_OA_calc - Trd_UA_calc AS MaxDeduct ;
FROM csr01_fi_b ;
INTO CURSOR csr01_fi_c
SELECT dealer, cust_state, cust_cnty, cust_city, taxcode1, prefix, typesale_a, stocknum, refnum, ;
jrnl_date, rev_date, namelastfi, taxcode2, taxcode3, sale_amt, ;
CapCostRed_calc, ;
Trd_ACV_calc, ;
Trd_OA_calc, ;
Trd_UA_calc, ;
MaxDeduct, ;
Amkt_FE_calc, ;
Amkt_BE_calc, ;
DocFee_calc, ;
AcqFee_calc, ;
taxamt1, taxamt2, taxamt3, ct, taxrate ;
FROM csr01_fi_c ;
INTO CURSOR csr01_fi_d
BROWSE
*****************************************************************
** the following generates the error: "csr01_fi_d must be created with SELECT ... INTO TABLE"
SELECT * ;
FROM csr01_fi_d ;
INTO CURSOR csrSrc01_fi_e
*****************************************************************
***************************************************************************
Any help is greatly appreciated.
Dave Higgins