Ora-01456
Am attempting to link a Stored Procedure into a new Crystal report using an ODBC datasource.
Receiving the following Oracle/ODBC error : ora-01456: may not peform insert/delete/update operation inside a READ ONLY transaction.
Database is an Oracle 10G, ODBC driver is 9.2.0.0 and Crystal report is version 8.0.1.1.
The error only appears in procedures performing an update - it seems to occur with the RAISE statement of the EXCEPTION error handling at the end of the procedure.
Have verified that procedure which only performs SELECTs and no UPDATE/DELETE/INSERT does work with the ODBC driver.
Code for SP :
CREATE OR REPLACE PROCEDURE P_ps_VC_NEW_SALES_tst2
io_vc_new_sales_cursor IN OUT k_new_sales.vc_new_sales_cursor
, branch_from IN NUMBER -- 1
, branch_to IN NUMBER -- 2
, date_from IN DATE -- 3
, date_to IN DATE -- 4
, product_from IN VARCHAR2 DEFAULT NULL -- 5
, product_to IN VARCHAR2 DEFAULT NULL -- 6
, customer_from IN NUMBER DEFAULT NULL -- 7
, customer_to IN NUMBER DEFAULT NULL -- 8
, company_value IN cpwcompany.cpwcompany%TYPE DEFAULT NULL -- 9
, class_1 IN VARCHAR2 DEFAULT NULL -- 10
, class_2 IN VARCHAR2 DEFAULT NULL -- 11
, class_3 IN VARCHAR2 DEFAULT NULL -- 12
, line_type IN VARCHAR2 DEFAULT NULL -- 13
is
v_crystal_rep_seq NUMBER;
v_branch_from NUMBER := branch_from; -- 1
v_branch_to NUMBER := branch_to; -- 2
v_date_from DATE := date_from; -- 3
v_date_to DATE := date_to; -- 4
v_part_from VARCHAR2(20) := RTRIM(UPPER(product_from)); -- 5
v_part_to VARCHAR2(20) := RTRIM(UPPER(product_to)); -- 6
v_contact_from NUMBER := customer_from; -- 7
v_contact_to NUMBER := customer_to; -- 8
v_company cpwcompany.cpwcompany%TYPE :=RTRIM(UPPER(company_value)); -- 9
v_prclas1 VARCHAR2(5) := class_1; -- 10
v_prclas2 VARCHAR2(5) := class_2; -- 11
v_prclas3 VARCHAR2(5) := class_3; -- 12
v_tpltyp VARCHAR2(3) := line_type; -- 13
v_rowcount NUMBER(10) := 0;
v_ret_rowcount NUMBER(10) := 0;
v_branch_from_p NUMBER := branch_from;
v_branch_to_p NUMBER := branch_to;
v_use_part VARCHAR2(1) := 'F'; -- 1
v_use_contact VARCHAR2(1) := 'F'; -- 2
v_use_co VARCHAR2(1) := 'F'; -- 3
v_use_prclas123 VARCHAR2(1) := 'F'; -- 4
v_use_prclas3 VARCHAR2(1) := 'F'; -- 5
v_use_tpl_typ VARCHAR2(1) := 'F'; -- 6
v_crystal_rep_tmp NUMBER;
v_co_tot NUMBER;
v_co_tot_all NUMBER;
v_sqlcode NUMBER := 0;
v_sqlerrm VARCHAR2(100);
v_start_time DATE;
v_phase NUMBER := 0;
v_path VARCHAR2(10);
v_gross_margin NUMBER := 0;
v_gross_margin_pct NUMBER := 0;
v_discount_pct NUMBER := 0;
PROCEDURE p_get_branches
IS
-- Get next 60 branches.
CURSOR c_branch
IS
SELECT branch
FROM branch
WHERE branch >= v_branch_from_p
ORDER BY branch
r_branch c_branch%ROWTYPE;
BEGIN
v_rowcount := 0;
v_branch_to_p := LEAST(0,v_branch_from - 1);
OPEN c_branch;
LOOP
FETCH c_branch INTO r_branch;
EXIT WHEN c_branch%NOTFOUND;
EXIT WHEN r_branch.branch > v_branch_to;
v_branch_to_p := r_branch.branch;
v_rowcount := v_rowcount + 1;
EXIT WHEN v_rowcount >= 60;
END LOOP;
CLOSE c_branch;
END p_get_branches;
BEGIN
v_phase := 100;
v_start_time := SYSDATE;
-- Stage 1.
-- Sort out input parameters.
IF v_company IS NULL
THEN
v_company := '%';
END IF;
v_company := REPLACE(v_company,'*','%');
IF v_prclas1 IS NULL
THEN
v_prclas1 := '%';
END IF;
v_prclas1 := REPLACE(v_prclas1,'*','%');
IF v_prclas2 IS NULL
THEN
v_prclas2 := '%';
END IF;
v_prclas2 := REPLACE(v_prclas2,'*','%');
IF v_prclas3 IS NULL
THEN
v_prclas3 := '%';
END IF;
v_prclas3 := REPLACE(v_prclas3,'*','%');
IF v_tpltyp IS NULL
THEN
v_tpltyp := '%';
END IF;
v_tpltyp := REPLACE(v_tpltyp,'*','%');
IF v_part_from IN ('%','*')
THEN
v_part_from := NULL;
END IF;
IF v_part_to IN ('%','*')
THEN
v_part_to := NULL;
END IF;
IF SUBSTR(v_part_to,1,1) <=
CHR(ASCII(SUBSTR(v_part_from,1,1)) + 1) AND
SUBSTR(v_part_to,1,1) >= 'A'
THEN
v_use_part := 'T';
END IF;
IF v_contact_to < (v_contact_from + 100)
THEN
v_use_contact := 'T';
END IF;
IF SUBSTR(v_prclas3,1,1) BETWEEN '0' AND '9' AND
SUBSTR(v_prclas3,2,1) BETWEEN '0' AND '9' AND
SUBSTR(v_prclas3,3,1) BETWEEN '0' AND '9'
THEN
v_use_prclas3 := 'T';
END IF;
IF v_prclas1 BETWEEN '0' AND '999' AND
v_prclas2 BETWEEN '0' AND '999' AND
v_prclas3 BETWEEN '0' AND '999'
THEN
v_use_prclas3 := 'F';
v_use_prclas123 := 'T';
END IF;
IF v_tpltyp != '%'
THEN
v_use_tpl_typ := 'T';
END IF;
IF v_use_part = 'F' AND
v_use_contact = 'F' AND
v_use_prclas3 = 'F' AND
NVL(v_company,'%') != '%'
THEN
SELECT COUNT(*)
INTO v_co_tot
FROM branch
WHERE cpwcompany = v_company
AND branch BETWEEN v_branch_from AND v_branch_to
SELECT COUNT(*)
INTO v_co_tot_all
FROM branch
WHERE branch BETWEEN v_branch_from AND v_branch_to
IF v_co_tot IS NOT NULL AND
v_co_tot_all > 0 AND
v_co_tot_all > 20 AND
( v_co_tot / v_co_tot_all ) < 0.25
THEN
v_use_co := 'T';
END IF;
END IF;
v_phase := 200;
SELECT crystal_rep_seq.NEXTVAL
INTO v_crystal_rep_seq
FROM DUAL
INSERT INTO crystal_rep_log
VALUES
( v_crystal_rep_seq
, 'CSaSa024 New Sales Report with Commissions'
, SUBSTR(v_branch_from ||' '|| v_branch_to ||' '|| v_date_from ||' '||
v_date_to || ' ' || v_part_from || ' ' ||
v_part_to || ' ' || v_contact_from || ' ' || v_contact_to || ' ' ||
v_company || ' ' || v_prclas1 || ' ' ||
v_prclas2 || ' ' || v_prclas3 || ' ' || v_tpltyp,1, 100
, SYSDATE, TO_CHAR(SYSDATE,'hh24:mi:ss')
, NULL, NULL
, 0, NULL, NULL
COMMIT;
insert into VC_NEW_SALES_DETAILED_LOG values (v_crystal_rep_seq,1,TO_CHAR(SYSDATE,'hh24:mi:ss'),
'Report initialised'||v_use_part||v_use_contact||v_use_co||v_use_prclas123||v_use_prclas3||v_use_tpl_typ);
commit;
v_phase := 300;
v_path := NULL;
IF
v_use_part = 'T' OR -- 1
v_use_contact = 'T' OR -- 2
v_use_co = 'T' OR -- 3
v_use_prclas123 = 'T' OR -- 4
v_use_prclas3 = 'T' OR -- 5
v_use_tpl_typ = 'T' -- 6
THEN
insert into VC_NEW_SALES_DETAILED_LOG values (
v_crystal_rep_seq,
2,
TO_CHAR(SYSDATE,'hh24:mi:ss'),
'special path '||'9');
commit;
SELECT crystal_rep_seq.CURRVAL
INTO v_crystal_rep_tmp
FROM DUAL
IF v_use_contact = 'T'
THEN
v_phase := 320;
v_path := 'CONTACT:';
INSERT INTO vc_new_sales_tab
( vc_new_sales_tab_ID
, TRANSACTION
SELECT
v_crystal_rep_tmp
, transaction
FROM transaction t1
WHERE t1.invoice_dat BETWEEN v_date_from AND v_date_to
AND t1.branch BETWEEN v_branch_from AND v_branch_to
AND t1.contact BETWEEN v_contact_from AND v_contact_to
ELSIF v_use_prclas123 = 'T'
THEN
v_phase := 325;
v_path := 'PRCLS123:';
INSERT INTO vc_new_sales_tab
( vc_new_sales_tab_ID
, TRANSACTION
SELECT
v_crystal_rep_tmp
, t1.transaction
FROM transaction t1,
tprodline t2,
product t3
WHERE t1.invoice_dat BETWEEN v_date_from AND v_date_to
AND t1.branch BETWEEN v_branch_from AND v_branch_to
AND t2.transaction = t1.transaction
AND t3.product = t2.product
AND t3.prclas1 = v_prclas1
AND t3.prclas2 = v_prclas2
AND t3.prclas3 = v_prclas3
GROUP BY t1.transaction
ELSIF v_use_part = 'T'
THEN
v_phase := 330;
v_path := 'PART:';
INSERT INTO vc_new_sales_tab
( vc_new_sales_tab_ID
, TRANSACTION
SELECT
v_crystal_rep_tmp
, t1.transaction
FROM transaction t1,
tprodline t2,
product t3
WHERE t1.invoice_dat BETWEEN v_date_from AND v_date_to
AND t1.branch BETWEEN v_branch_from AND v_branch_to
AND t2.transaction = t1.transaction
AND t3.product = t2.product
AND t3.part BETWEEN v_part_from AND v_part_to
GROUP BY t1.transaction
ELSIF v_use_tpl_typ = 'T'
THEN
v_phase := 335;
v_path := 'TPLTYP:';
INSERT INTO vc_new_sales_tab
( vc_new_sales_tab_ID
, TRANSACTION
SELECT
v_crystal_rep_tmp
, t1.transaction
FROM transaction t1,
tprodline t2
WHERE t1.invoice_dat BETWEEN v_date_from AND v_date_to
AND t1.branch BETWEEN v_branch_from AND v_branch_to
AND t2.transaction = t1.transaction
AND t2.tpltyp = v_tpltyp
GROUP BY t1.transaction
ELSIF v_use_prclas3 = 'T'
THEN
v_phase := 340;
v_path := 'PRCLS3:';
INSERT INTO vc_new_sales_tab
( vc_new_sales_tab_ID
, TRANSACTION
SELECT
v_crystal_rep_tmp
, t1.transaction
FROM transaction t1,
tprodline t2,
product t3
WHERE t1.invoice_dat BETWEEN v_date_from AND v_date_to
AND t1.branch BETWEEN v_branch_from AND v_branch_to
AND t2.transaction = t1.transaction
AND t3.product = t2.product
AND t3.prclas3 = v_prclas3
GROUP BY t1.transaction
ELSE
insert into VC_NEW_SALES_DETAILED_LOG values (v_crystal_rep_seq,3,TO_CHAR(SYSDATE,'hh24:mi:ss'),
'special path ready to insert wanted transactions '||v_company);
commit;
v_phase := 350;
v_path := 'COMPANY:';
INSERT INTO vc_new_sales_tab
( vc_new_sales_tab_ID
, TRANSACTION
SELECT
v_crystal_rep_tmp
, transaction
FROM transaction t1,
branch t2
WHERE t1.invoice_dat BETWEEN v_date_from AND v_date_to
AND t1.branch BETWEEN v_branch_from AND v_branch_to
AND t2.branch = t1.branch
AND t2.cpwcompany LIKE v_company
END IF;
v_ret_rowcount := SQL%ROWCOUNT;
insert into VC_NEW_SALES_DETAILED_LOG values (v_crystal_rep_seq,4,TO_CHAR(SYSDATE,'hh24:mi:ss'),
'special path: Inserted only wanted transactions ' || v_ret_rowcount);
commit;
COMMIT;
insert into VC_NEW_SALES_DETAILED_LOG values (v_crystal_rep_seq,5,TO_CHAR(SYSDATE,'hh24:mi:ss'),
'special path: Commited the changes. Ready to insert from the view. '||v_crystal_rep_tmp||','||v_date_from||','||v_date_to||','||v_branch_from||','||v_branch_to||','||v_company||','||v_prclas1||','||v_prclas2||','||v_prclas3);
commit;
v_phase := v_phase + 1;
INSERT INTO vc_new_sales_tab
SELECT /*+ ORDERED */
v_crystal_rep_seq
, t1.*
, F_COMM_VALUES(t1.transaction,t1.tprodline,t1.invoice_dat,t1.product, t1.prod_qty)
FROM vc_new_sales_tab t0,
vc_new_sales t1
WHERE t0.vc_new_sales_tab_id = v_crystal_rep_tmp
AND t1.transaction = t0.transaction
AND t1.invoice_dat BETWEEN v_date_from AND v_date_to
AND t1.branch BETWEEN v_branch_from AND v_branch_to
AND t1.cpwcompany LIKE v_company
AND t1.prclas1 LIKE v_prclas1
AND t1.prclas2 LIKE v_prclas2
AND t1.prclas3 LIKE v_prclas3
AND t1.tpltyp LIKE v_tpltyp
AND t1.part BETWEEN NVL(v_part_from,' ')
AND NVL(v_part_to,'zzzzz')
AND (t1.contact BETWEEN NVL(v_contact_from,0)
AND NVL(v_contact_to,99999999999999)
or t1.contact is null or t1.contact = 0)
v_ret_rowcount := SQL%ROWCOUNT;
insert into VC_NEW_SALES_DETAILED_LOG values (v_crystal_rep_seq,6,TO_CHAR(SYSDATE,'hh24:mi:ss'),
'special path: ' || v_ret_rowcount || ' Rows inserted from the view.');
commit;
COMMIT;
insert into VC_NEW_SALES_DETAILED_LOG values (v_crystal_rep_seq,7,TO_CHAR(SYSDATE,'hh24:mi:ss'),
'special path: Rows commited.');
commit;
ELSE
insert into VC_NEW_SALES_DETAILED_LOG values (v_crystal_rep_seq,8,TO_CHAR(SYSDATE,'hh24:mi:ss'),
'We don t use a special path. Ready to insert rows from view.');
commit;
v_branch_from_p := v_branch_from;
LOOP
p_get_branches;
IF v_branch_to_p < v_branch_from_p
THEN
EXIT;
END IF;
insert into VC_NEW_SALES_DETAILED_LOG values (v_crystal_rep_seq,9,TO_CHAR(SYSDATE,'hh24:mi:ss'),
'Just before the INSERT statement. ('||v_phase||')'||' '||v_branch_from_p||' '||v_branch_to_p||' '||v_date_from||' '||v_date_to);
commit;
INSERT INTO vc_new_sales_tab
SELECT /*+ RULE */
v_crystal_rep_seq
, B.CPWCOMPANY
, T.BRANCH
, nvl(SA.SALESAREA,'NONE') SALESAREA
, nvl(SA.DESCR,'NONE') salesarea_desc
, nvl(SD.SALESDIVISION,'NONE') SALESDIVISION
, nvl(SD.DESCR,'NONE') salesdivision_desc
, T.OPEN_DAT
, T.INVOICE_DAT
, T.CLOSED_DAT
, T.TRANSACTION
, T.OPEN_TIM -- New Field (returned with open date query)
, TP.TPRODLINE
, tc.tconnline -- for testing
, T.DOCKET_NUM
, PART.PART
, NVL(PMODEL.WAP_FLG,'~') WAP_FLG
, P.ITEMCOND_ID
, TPT.DESCR TPL_DESCR
, TPT.TPLTYP
, RWTYP.DESCR RETURN_REASON_DESC
, P.PRODUCT
, NVL(P.PRCLAS1,'None') PRCLAS1
, NVL(P.PRCLAS2,'None') PRCLAS2
, NVL(P.PRCLAS3,'None') PRCLAS3
, NVL(P.DESCR,'~') PRODUCT_DESC
, NVL(TC.TARIFF,'~') TARIFF
, NVL(TC.TARVARTYP,'~') TARVARTYP
, NVL(CTYP.DESCR,'~') CON_TYPE_DSC
, T.TRANS_STATUS -- Optional
, T.TRANS_TYPE TRANSACTION_TYPE
, NVL(T.CONTACT,0) CONTACT
, NVL(decode(ins.promotion_flg,'T','Y','N'),'~') EARLY_BIRD
, T.EMPLOYEE_TRANS
, T.EMPLOYEE_COMMIS
, NVL(TPT.SAL_GL_COD,PR3.SAL_GL_COD) GL_SAL_COD
, NVL(NVL(TPT.COS_GL_COD,PR3.COS_GL_COD),'~') GL_COST_COD
, NVL(D.DISCWHY,'~') DISCWHY
, ' '||NVL(translate(D.TEXT,chr(13),' '),'~')||' ' TEXT
, NVL(TPP.PPLAN,0) PPLAN
, NVL(TP.ORDER_QTY,0) PROD_QTY
, NVL(TP.RETAIL_AMT,0) UNIT_RETAIL_AMT
, NVL(TP.RETAIL_AMT,0)*NVL(TP.ORDER_QTY,0) TOT_RETAIL_AMT
, NVL(TP.SALE_AMT,0) UNIT_SALE_AMT
, NVL(TP.SALE_AMT * TP.ORDER_QTY,0) TOT_SALE_AMT
, NVL((TP.SALE_AMT * 100 / (100 + TP.VATRATE)) * TP.ORDER_QTY,0) TOT_NET_AMT
, NVL(TP.ORDER_QTY*(TP.RETAIL_AMT- TP.SALE_AMT),0) TOT_DISC_AMT
, NVL((TP.SALE_AMT - (TP.SALE_AMT * 100 / (100 + TP.VATRATE))) * TP.ORDER_QTY,0) TOT_VAT_AMT
, NVL(TP.VATRATE,0) VATRATE
, NVL(f_sales_cost_amt(tp.transaction, tp.tprodline),0) PROD_COST_AMT
, ((nvl(f_sales_cost_amt(tp.transaction, tp.tprodline),0) + nvl(f_prod_lossinvalue(tp.transaction,tp.tprodline),0)) * TP.ORDER_QTY) PROD_TOTCOST_AMT
, ((NVL((f_prod_lossinvalue(tp.transaction,tp.tprodline)),0) * tp.order_qty)* -1) LOSSINVALUE -- Check this
, SUBSTR(f_comm_bands(tp.transaction,tp.tprodline,T.INVOICE_DAT),1,5) COMMSN_BAND
, F_COMM_VALUES(t.transaction,tp.tprodline,t.invoice_dat,tp.product, tp.order_qty) COMMISSIONS_OUTPUT
FROM
connection c
, tconnline tc
, retwhy rw
, retwhytyp rwtyp
, branch b
, salesarea sa
, salesdivision sd
, connect_type ctyp
, tpplan tpp
, tpltyp tpt
, discount d
, product p
, insurance ins
, tprodline tp -- Driving Table
, transaction t
, prclas3 pr3
, part
, partmodel pmodel
WHERE
t.invoice_dat BETWEEN v_date_from AND v_date_to and
t.branch BETWEEN v_branch_from_p AND v_branch_to_p and
part.part BETWEEN NVL(v_part_from,' ') and NVL(v_part_to,'zzzzz') and
p.prclas1 LIKE v_prclas1 and
p.prclas2 LIKE v_prclas2 and
p.prclas3 LIKE v_prclas3 and
(t.contact BETWEEN NVL(v_contact_from,0) AND NVL(v_contact_to,99999999999999)
or t.contact is null) and
b.cpwcompany LIKE v_company and
PR3.prclas1 (+) = P.prclas1 and
PR3.prclas2 (+) = P.prclas2 and
PR3.prclas3 (+) = P.prclas3 and
P.product (+) = TP.product and
PART.PART (+) = P.PART and
pmodel.partmodel (+) = part.partmodel and
TP.transaction (+) = T.transaction and
T.branch = B.branch and
SA.salesarea (+) = B.salesarea and
SD.salesdivision (+) = SA.salesdivision and
TC.transaction (+) = TP.transaction and
TC.tprodline (+) = TP.tprodline and
RW.transaction (+) = TP.transaction and
RW.tprodline (+) = TP.tprodline and
INS.transaction (+) = TP.transaction and
INS.tprodline (+) = TP.tprodline and
D.transaction (+) = TP.transaction and
D.tprodline (+) = TP.tprodline and
TPT.tpltyp (+) = TP.tpltyp and
C.tconnline (+) = TC.tconnline and
RWTYP.retwhytyp (+) = RW.retwhytyp and
TPP.servcon (+) = C.servcon and
CTYP.connect_type (+) = C.connect_type and
C.SEQNO (+) = 1
v_ret_rowcount := SQL%ROWCOUNT;
insert into VC_NEW_SALES_DETAILED_LOG values (v_crystal_rep_seq,9,TO_CHAR(SYSDATE,'hh24:mi:ss'),
v_ret_rowcount || ' Rows inserted into table. ('||v_phase||')');
commit;
COMMIT;
insert into VC_NEW_SALES_DETAILED_LOG values (v_crystal_rep_seq,10,TO_CHAR(SYSDATE,'hh24:mi:ss'),
'Changes commited. ('||v_phase||')');
commit;
v_branch_from_p := v_branch_to_p + 1;
v_phase := v_phase + 1;
END LOOP;
END IF;
COMMIT;
insert into VC_NEW_SALES_DETAILED_LOG values (v_crystal_rep_seq,11,TO_CHAR(SYSDATE,'hh24:mi:ss'),
'All changes commited.');
commit;
v_phase := 400;
DELETE vc_new_sales_tab t1
WHERE t1.vc_new_sales_tab_id = v_crystal_rep_seq
AND t1.transaction IS NOT NULL
AND t1.tprodline IS NULL
v_ret_rowcount := SQL%ROWCOUNT;
insert into VC_NEW_SALES_DETAILED_LOG values (v_crystal_rep_seq,12,TO_CHAR(SYSDATE,'hh24:mi:ss'),
v_ret_rowcount || ' Deletion if quick.');
commit;
v_phase := 410;
DELETE vc_new_sales_tab t1
WHERE t1.part IS NOT NULL
AND EXISTS
(SELECT NULL
FROM product t2
WHERE t2.product = t1.product
AND t2.part != t1.part
AND EXISTS
(SELECT NULL
FROM vc_new_sales_tab t3,
product t4
WHERE t3.vc_new_sales_tab_id = t1.vc_new_sales_tab_id
AND t3.transaction = t1.transaction
AND t3.tprodline = t1.tprodline
AND t4.product = t3.product
AND t4.part = t3.part
AND t1.vc_new_sales_tab_id = v_crystal_rep_seq
v_ret_rowcount := SQL%ROWCOUNT;
insert into VC_NEW_SALES_DETAILED_LOG values (v_crystal_rep_seq,13,TO_CHAR(SYSDATE,'hh24:mi:ss'),
v_ret_rowcount || ' Quick deletion done.');
commit;
v_phase := 420;
END IF;
v_phase := 500;
insert into VC_NEW_SALES_DETAILED_LOG values (v_crystal_rep_seq,14,TO_CHAR(SYSDATE,'hh24:mi:ss'),
'Duplicate deletion.');
commit;
DELETE vc_new_sales_tab t1
WHERE EXISTS
(SELECT /*+ RULE */
NULL
FROM vc_new_sales_tab t2
WHERE
t2.vc_new_sales_tab_id = v_crystal_rep_seq
AND t2.transaction = t1.transaction
AND t2.tprodline = t1.tprodline
AND t2.rowid || '' > t1.rowid
AND t1.vc_new_sales_tab_id = v_crystal_rep_seq
v_ret_rowcount := SQL%ROWCOUNT;
insert into VC_NEW_SALES_DETAILED_LOG values (v_crystal_rep_seq,15,TO_CHAR(SYSDATE,'hh24:mi:ss'),
v_ret_rowcount || ' duplicate deletionS done.');
commit;
COMMIT;
insert into VC_NEW_SALES_DETAILED_LOG values (v_crystal_rep_seq,16,TO_CHAR(SYSDATE,'hh24:mi:ss'),
'Duplicate deletetion commited.');
commit;
insert into VC_NEW_SALES_DETAILED_LOG values (v_crystal_rep_seq,17,TO_CHAR(SYSDATE,'hh24:mi:ss'),
'Ready to select rows from temp table.');
commit;
v_phase := 600;
OPEN io_vc_new_sales_cursor FOR
SELECT /*+ RULE */
VC_NEW_SALES_TAB_ID
, CPWCOMPANY
, BRANCH
, SALESAREA
, SALESAREA_DESC
, SALESDIVISION
, SALESDIVISION_DESC
, OPEN_DAT
, INVOICE_DAT
, CLOSED_DAT
, TRANSACTION
, OPEN_TIM
, TPRODLINE
, TCONNLINE
, DOCKET_NUM
, PART
, WAP_FLG
, ITEMCOND_ID
, TPL_DESCR
, TPLTYP
, RETURN_REASON_DESC
, PRODUCT
, PRCLAS1
, PRCLAS2
, PRCLAS3
, PRODUCT_DESC
, TARIFF
, TARVARTYP
, CON_TYPE_DSC
, TRANS_STATUS
, TRANSACTION_TYPE
, CONTACT
, EARLY_BIRD
, EMPLOYEE_TRANS
, EMPLOYEE_COMMIS
, GL_SAL_COD
, GL_COST_COD
, DISCWHY
, TEXT
, PPLAN
, PROD_QTY
, UNIT_RETAIL_AMT
, TOT_RETAIL_AMT
, UNIT_SALE_AMT
, TOT_SALE_AMT
, TOT_NET_AMT
, TOT_DISC_AMT
, TOT_VAT_AMT
, VATRATE
, PROD_COST_AMT
, PROD_TOTCOST_AMT
, LOSSINVALUE
, COMMSN_BAND -- Insert Commissions Bands next
, to_number(nvl(
substr(COMMISSIONS_OUTPUT
, 1
, (instr(COMMISSIONS_OUTPUT,'*',1,1)-1)
),0)
) COMMSN_BASIC
, to_number(nvl(
substr(COMMISSIONS_OUTPUT
, (instr(COMMISSIONS_OUTPUT,'*',1,1)+1)
, ((instr(COMMISSIONS_OUTPUT,'*',1,2)-
instr(COMMISSIONS_OUTPUT,'*',1,1))-1)
),0)
) COMMSN_VOLUME
, to_number(nvl(
substr(COMMISSIONS_OUTPUT
, (instr(COMMISSIONS_OUTPUT,'*',1,2)+1)
, ((instr(COMMISSIONS_OUTPUT,'*',1,3)-
instr(COMMISSIONS_OUTPUT,'*',1,2))-1)
),0)
) COMMSN_LOYALTY
, to_number(nvl(
substr(COMMISSIONS_OUTPUT
, (instr(COMMISSIONS_OUTPUT,'*',1,3)+1)
, ((instr(COMMISSIONS_OUTPUT,'*',1,4)-
instr(COMMISSIONS_OUTPUT,'*',1,3))-1)
),0)
) COMMSN_ITEM
, to_number(nvl(
substr(COMMISSIONS_OUTPUT
, (instr(COMMISSIONS_OUTPUT,'*',1,4)+1)
, ((instr(COMMISSIONS_OUTPUT,'*',1,5)-
instr(COMMISSIONS_OUTPUT,'*',1,4))-1)
),0)
) COMMSN_OTHER
, to_number(nvl(
substr(COMMISSIONS_OUTPUT
, (instr(COMMISSIONS_OUTPUT,'*',1,5)+1)
, ((instr(COMMISSIONS_OUTPUT,'*',1,6)-
instr(COMMISSIONS_OUTPUT,'*',1,5))-1)
),0)
) COMMSN_PRODUCT
FROM vc_new_sales_tab
WHERE vc_new_sales_tab_id = v_crystal_rep_seq
ORDER BY transaction, tprodline
v_ret_rowcount := SQL%ROWCOUNT;
insert into VC_NEW_SALES_DETAILED_LOG values (v_crystal_rep_seq,18,TO_CHAR(SYSDATE,'hh24:mi:ss'),
v_ret_rowcount || ' Rows selected from temp table.');
commit;
-- Stage 7.
-- Record processing end.
v_phase := 700;
UPDATE crystal_rep_log
SET run_date_en = SYSDATE,
run_date_en_time = TO_CHAR(SYSDATE, 'hh24:mi:ss'),
rep_params = SUBSTR(v_path || rep_params, 1, 100)
WHERE crystal_rep_id = v_crystal_rep_seq
COMMIT;
insert into VC_NEW_SALES_DETAILED_LOG values (v_crystal_rep_seq,19,TO_CHAR(SYSDATE,'hh24:mi:ss'),
'Report terminated');
commit;
EXCEPTION
WHEN OTHERS THEN
v_sqlcode := sqlcode;
v_sqlerrm := SUBSTR(sqlerrm,1,100);
UPDATE crystal_rep_log
SET run_date_en = SYSDATE,
run_date_en_time = TO_CHAR(SYSDATE, 'hh24:mi:ss'),
run_status = -1,
run_sqlcode = v_sqlcode,
run_sqlerrm = SUBSTR('STAGE '||v_phase||' '||v_sqlerrm,1,100)
WHERE crystal_rep_id = v_crystal_rep_seq
COMMIT;
RAISE;
END P_ps_VC_NEW_SALES_tst2;
Thanks for the suggestion but does not work for me.
Firstly, using the Oracle native driver causes a ref cursor parameter to be added to the report parameters.
More importantly, Crystal returns the following error :
- Cannot open database.
- File integrity error.
I suspect that our version of Crystal (8.0.1.1) is incompatible with Oracle 10g - this version of Crystal is not supported any longer.
Similar Messages
-
UPDATE problem - [Oracle][ODBC][Ora]ORA-01456
I try to UPDATE a table using following driver, url and syntax :
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); // load driver
Connection conn = DriverManager.getConnection("jdbc:odbc:JDEV", "salgsinfo", "si"); // get connection
but receives this answer :
java.sql.SQLException: [Oracle][ODBC][Ora]ORA-01456: INSERT-, DELETE- or UPDATE-statements cannot be done in READ ONLY-transaction
the user is granted dba priviliges, what can i do ?
NielsORA-01456:may not perform insert/delete/update operation inside a READONLY transaction
Cause:A non-DDL INSERT/DELETE/UPDATE or SELECT FOR UPDATE operation was attempted.
Action:Commit or roll back the current transaction, then retry the operation. -
ORA-01456 : may not perform insert/delete/update operation
When I use following stored procedure with crystal reports, following error occurs.
ORA-01456 : may not perform insert/delete/update operation inside a READ ONLY transaction
Kindly help me on this, please.
My stored procedure is as under:-
create or replace
PROCEDURE PROC_FIFO
(CV IN OUT TB_DATA.CV_TYPE,FDATE1 DATE, FDATE2 DATE,
MSHOLD_CODE IN NUMBER,SHARE_ACCNO IN VARCHAR)
IS
--DECLARE VARIABLES
V_QTY NUMBER(10):=0;
V_RATE NUMBER(10,2):=0;
V_AMOUNT NUMBER(12,2):=0;
V_DATE DATE:=NULL;
--DECLARE CURSORS
CURSOR P1 IS
SELECT *
FROM FIFO
WHERE SHARE_TYPE IN ('P','B','R')
ORDER BY VOUCHER_DATE,
CASE WHEN SHARE_TYPE='P' THEN 1
ELSE
CASE WHEN SHARE_TYPE='R' THEN 2
ELSE
CASE WHEN SHARE_TYPE='B' THEN 3
END
END
END,
TRANS_NO;
RECP P1%ROWTYPE;
CURSOR S1 IS
SELECT * FROM FIFO
WHERE SHARE_TYPE='S'
AND TRANS_COST IS NULL
ORDER BY VOUCHER_DATE,TRANS_NO;
RECS S1%ROWTYPE;
--BEGIN QUERIES
BEGIN
DELETE FROM FIFO;
--OPENING BALANCES
INSERT INTO FIFO
VOUCHER_NO,VOUCHER_TYPE,VOUCHER_DATE,TRANS_QTY,TRANS_AMT,TRANS_RATE,
SHOLD_CODE,SHARE_TYPE,ACC_NO,SHARE_CODE,TRANS_NO)
SELECT TO_CHAR(FDATE1,'YYYYMM')||'001' VOUCHER_NO,'OP' VOUCHER_TYPE,
FDATE1-1 VOUCHER_DATE,
SUM(
CASE WHEN
--((SHARE_TYPE ='S' AND DTAG='Y')
SHARE_TYPE IN ('P','B','R','S') THEN
TRANS_QTY
ELSE
0
END
) TRANS_QTY,
SUM(TRANS_AMT),
NVL(CASE WHEN SUM(TRANS_AMT)<>0
AND
SUM
CASE WHEN SHARE_TYPE IN ('P','B','R','S') THEN
TRANS_QTY
ELSE
0
END
)<>0 THEN
SUM(TRANS_AMT)/
SUM
CASE WHEN SHARE_TYPE IN ('P','B','R','S') THEN
TRANS_QTY
ELSE
0
END
) END,0) TRANS_RATE,
MSHOLD_CODE SHOLD_CODE,'P' SHARE_TYPE,SHARE_ACCNO ACC_NO,
SHARE_CODE,0 TRANS_NO
FROM TRANS
WHERE ACC_NO=SHARE_ACCNO
AND SHOLD_CODE= MSHOLD_CODE
AND VOUCHER_DATE<FDATE1
--AND
--(SHARE_TYPE='S' AND DTAG='Y')
--OR SHARE_TYPE IN ('P','R','B'))
group by TO_CHAR(FDATE1,'YYYYMM')||'001', MSHOLD_CODE,SHARE_ACCNO, SHARE_CODE;
COMMIT;
--TRANSACTIONS BETWEEND DATES
INSERT INTO FIFO
TRANS_NO,VOUCHER_NO,VOUCHER_TYPE,
VOUCHER_DATE,TRANS_QTY,
TRANS_RATE,TRANS_AMT,SHOLD_CODE,SHARE_CODE,ACC_NO,
DTAG,TRANS_COST,SHARE_TYPE
SELECT TRANS_NO,VOUCHER_NO,VOUCHER_TYPE,
VOUCHER_DATE,TRANS_QTY,
CASE WHEN SHARE_TYPE='S' THEN
NVL(TRANS_RATE-COMM_PER_SHARE,0)
ELSE
NVL(TRANS_RATE+COMM_PER_SHARE,0)
END
,TRANS_AMT,SHOLD_CODE,SHARE_CODE,ACC_NO,
DTAG,NULL TRANS_COST,SHARE_TYPE
FROM TRANS
WHERE ACC_NO=SHARE_ACCNO
AND SHOLD_CODE= MSHOLD_CODE
AND VOUCHER_DATE BETWEEN FDATE1 AND FDATE2
AND
((SHARE_TYPE='S' AND DTAG='Y')
OR SHARE_TYPE IN ('P','R','B'));
COMMIT;
--PURCHASE CURSOR
IF P1%ISOPEN THEN
CLOSE P1;
END IF;
OPEN P1;
LOOP
FETCH P1 INTO RECP;
V_QTY:=RECP.TRANS_QTY;
V_RATE:=RECP.TRANS_RATE;
V_DATE:=RECP.VOUCHER_DATE;
dbms_output.put_line('V_RATE OPENING:'||V_RATE);
dbms_output.put_line('OP.QTY2:'||V_QTY);
EXIT WHEN P1%NOTFOUND;
--SALES CURSOR
IF S1%ISOPEN THEN
CLOSE S1;
END IF;
OPEN S1;
LOOP
FETCH S1 INTO RECS;
EXIT WHEN S1%NOTFOUND;
dbms_output.put_line('OP.QTY:'||V_QTY);
dbms_output.put_line('SOLD:'||RECS.TRANS_QTY);
dbms_output.put_line('TRANS_NO:'||RECS.TRANS_NO);
dbms_output.put_line('TRANS_NO:'||RECS.TRANS_NO);
IF ABS(RECS.TRANS_QTY)<=V_QTY
AND V_QTY<>0
AND RECS.TRANS_COST IS NULL THEN
--IF RECS.TRANS_COST IS NULL THEN
--dbms_output.put_line('SOLD:'||RECS.TRANS_QTY);
--dbms_output.put_line('BAL1:'||V_QTY);
UPDATE FIFO
SET TRANS_COST=V_RATE,
PUR_DATE=V_DATE
WHERE TRANS_NO=RECS.TRANS_NO
AND TRANS_COST IS NULL;
COMMIT;
dbms_output.put_line('UPDATE TRANS_NO:'||RECS.TRANS_NO);
dbms_output.put_line('OP.QTY:'||V_QTY);
dbms_output.put_line('SOLD:'||RECS.TRANS_QTY);
dbms_output.put_line('TRANS_NO:'||RECS.TRANS_NO);
dbms_output.put_line('BAL2:'||TO_CHAR(RECS.TRANS_QTY+V_QTY));
END IF;
IF ABS(RECS.TRANS_QTY)>ABS(V_QTY)
AND V_QTY<>0 AND RECS.TRANS_COST IS NULL THEN
UPDATE FIFO
SET
TRANS_QTY=-V_QTY,
TRANS_COST=V_RATE,
TRANS_AMT=ROUND(V_QTY*V_RATE,2),
PUR_DATE=V_DATE
WHERE TRANS_NO=RECS.TRANS_NO;
--AND TRANS_COST IS NULL;
COMMIT;
dbms_output.put_line('UPDATING 100000:'||TO_CHAR(V_QTY));
dbms_output.put_line('UPDATING 100000 TRANS_NO:'||TO_CHAR(RECS.TRANS_NO));
INSERT INTO FIFO
TRANS_NO,VOUCHER_NO,VOUCHER_TYPE,
VOUCHER_DATE,TRANS_QTY,
TRANS_RATE,TRANS_AMT,SHOLD_CODE,SHARE_CODE,ACC_NO,
DTAG,TRANS_COST,SHARE_TYPE,PUR_DATE
VALUES
MCL.NEXTVAL,RECS.VOUCHER_NO,RECS.VOUCHER_TYPE,
RECS.VOUCHER_DATE,RECS.TRANS_QTY+V_QTY,
RECS.TRANS_RATE,(RECS.TRANS_QTY+V_QTY)*RECS.TRANS_RATE,RECS.SHOLD_CODE,
RECS.SHARE_CODE,RECS.ACC_NO,
RECS.DTAG,NULL,'S',V_DATE
dbms_output.put_line('INSERTED RECS.QTY:'||TO_CHAR(RECS.TRANS_QTY));
dbms_output.put_line('INSERTED QTY:'||TO_CHAR(RECS.TRANS_QTY+V_QTY));
dbms_output.put_line('INSERTED V_QTY:'||TO_CHAR(V_QTY));
dbms_output.put_line('INSERTED RATE:'||TO_CHAR(V_RATE));
COMMIT;
V_QTY:=0;
V_RATE:=0;
EXIT;
END IF;
IF V_QTY>0 THEN
V_QTY:=V_QTY+RECS.TRANS_QTY;
ELSE
V_QTY:=0;
V_RATE:=0;
EXIT;
END IF;
--dbms_output.put_line('BAL3:'||V_QTY);
END LOOP;
V_QTY:=0;
V_RATE:=0;
END LOOP;
CLOSE S1;
CLOSE P1;
OPEN CV FOR
SELECT TRANS_NO,VOUCHER_NO,VOUCHER_TYPE,
VOUCHER_DATE,TRANS_QTY,
TRANS_RATE,TRANS_AMT,SHOLD_CODE,B.SHARE_CODE,B.ACC_NO,
DTAG,TRANS_COST,SHARE_TYPE, B.SHARE_NAME,A.PUR_DATE
FROM FIFO A, SHARES B
WHERE A.SHARE_CODE=B.SHARE_CODE
--AND A.SHARE_TYPE IS NOT NULL
ORDER BY VOUCHER_DATE,SHARE_TYPE,TRANS_NO;
END PROC_FIFO;
Thanks and Regards,
LuqmanCopy from TODOEXPERTOS.COM
Problem Description
When running a RAM build you get the following error as seen in the RAM build
log file:
14:52:50 2> Updating warehouse tables with build information...
Process Terminated In Error:
[Oracle][ODBC][Ora]ORA-01456: may not perform insert/delete/update operation inside a READ ONLY transaction
(SIGENG02) ([Oracle][ODBC][Ora]ORA-01456: may not perform insert/delete/update operation inside a READ ONLY transaction
) Please contact the administrator of your Oracle Express Server application.
Solution Description
Here are the following suggestions to try out:
1. You may want to use oci instead of odbc for your RAM build, provided you
are running an Oracle database. This is setup through the RAA (relational access
administrator) maintenance procedure.
Also make sure your tnsnames.ora file is setup correctly in either net80/admin
or network/admin directory, to point to the correct instance of Oracle.
2. Commit or rollback the current transaction, then retry running your
RAM build. Seems like one or more of your lookup or fact tables have a
read-only lock on them. This occurs if you modify or add some records to your
lookup or fact tables but forget to issue a commit or rollback. You need to do
this through SQL+.
3. You may need to check what permissions has been given to the relational user.
The error could be a permissions issue.
You must give 'connect' permission or roll to the RAM/relational user. You may
also try giving 'dba' and 'resource' priviliges/roll to this user as a test. Inorder to
keep it simple, make sure all your lookup, fact and wh_ tables are created on
a single new tablespace. Create a new user with the above privileges as the
owner of the tablespace, as well as the owner of the lookup, fact and wh_
tables, inorder to see if this is a permissions issue.
In this particular case, the problem was resolved by using oci instead of odbc,
as explained in suggestion# 1. -
Hi im using siebel analytcis.
I have created those tables required for configuring the scheduler in the database, i am able to start my scheduler services also.
But when i try to save an ibot, the following error comes:
Siebel iBots Server Error: [nQSError: 16001] ODBC error state: S1000 code: 1456 message: [Oracle][ODBC][Ora]ORA-01456: may not perform insert/delete/update operation inside a READ ONLY transaction . [nQSError: 16015] SQL statement execution failed. at stage of execute transaction command with data source:
Can anyone help on this?Hi
in metalink3 there a doc. for a similar issue , the doc id is 486843.1
thanks -
Error in implementing Usage Tracking in OBIEE
Hi All,
I wants to implement Usage Tracking in my project. I have done all the steps as per link http://obiee101.blogspot.com/2008/08/obiee-setting-up-usage-tracking.html
But i am getting following error in NQServer.log file----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[59048] Usage Tracking encountered an insert statement execution error. This error has occurred 1 times and resulted in the loss of 1 insert statements since this message was last logged.
[nQSError: 16001] ODBC error state: S1000 code: 1456 message: [Oracle][ODBC][Ora]ORA-01456: may not perform insert/delete/update operation inside a READ ONLY transaction.
[nQSError: 16015] SQL statement execution failed.
I have also check by changing the Call_Interface in Connection Pool of Admin Tool from ODBC 3.5 to OCI 10g. By this chage i get ollowing error:
[59048] Usage Tracking encountered an insert statement execution error. This error has occurred 1 times and resulted in the loss of 1 insert statements since this message was last logged.
[nQSError: 17001] Oracle Error code: 3114, message: ORA-03114: not connected to ORACLE
at OCI call OCIStmtExecute.
[nQSError: 17011] SQL statement execution failed.
Please help....
Thanks in Advance...
Regards,
Aviproblem is solved....
Actually in NQServer.ini file i was using actual Database name instead of Admin Tool Physical Layer name at PHSICAL TABLE NAME: <database>.<schema>.<tablename>
and at CONNECTION POOL: <database name>.<connection pool>
thanks... -
Query Engine Error in Crystal Report
I have a asp application with crystal report as reporting tool. Every thing works fine with Oracle 9i, but when i migrate to Oracle Database 10g Release2 some of the reports in crystal report shows following error report.
Query Engine Error:'HY00:[oracle][ODBC][ora]ora-01456:may not perform insert/delete/update operation inside a Read Only transaction.
ORA-06521:at "<dbusername>.<procedure name>,line 58
ORA-06512:at line1
I checked the database is in READ WRITE mode.
any help wolud be appreciated.
Thanks in Advance
DebashisHi,
This is posted in the wrong forum. This forum is for Oracle Berkeley DB. Please find the correct forum and post your question there.
Regards,
Alex Gorrod,
Oracle Berkeley DB -
Error with OBIEE Usage Tracking
Hi,
I have set up Usage Tracking in Oracle BI Enterprise Edition with the Direct Insert Option. I have created the S_NQ_ACCT table in an Oracle schema that is referenced as a connection pool in the Oracle BI Repository physical layer. When I run my requests from Oracle BI Answers and check my server logs (NQServer.log), I get the following message:
[59048] Usage Tracking encountered an insert statement execution error. This error has occurred 9 times and resulted in the loss of 9 insert statements since this message was last logged.
[nQSError: 16001] ODBC error state: S1000 code: 1456 message: [Oracle][ODBC][Ora]ORA-01456: may not perform insert/delete/update operation inside a READ ONLY transaction.
[nQSError: 16015] SQL statement execution failed.
2008-04-25 04:34:18
[59048] Usage Tracking encountered an insert statement execution error. This error has occurred 9 times and resulted in the loss of 9 insert statements since this message was last logged.
[nQSError: 16001] ODBC error state: S1000 code: 1456 message: [Oracle][ODBC][Ora]ORA-01456: may not perform insert/delete/update operation inside a READ ONLY transaction.
[nQSError: 16015] SQL statement execution failed.
Does anyone know how to fix this problem?
Regards,
PeterThanks for the response.
You're right. The response seems to imply that the account does not have the authorization. However, the account I am using to access the database from OBIEE Repository owns the schema where the S_NQ_ACCT table is stored. So I am puzzled as to why this response is generated. -
V8.16 returns error message upon opening database.
When opening a database using V8.16 support files and drivers the following error message is returned. "ODBC - Tunnel Error ORA-01456: may not perform insert/delete/update operation inside a READ ONLY transaction.
This error does not occur using V8.15.
What is the cause of this problem?You don't by any chance have the 'connect in read-only mode' option checked on your DSN do you?
Justin Cave -
Error when using another report in my filter
Hi experts
when i m creating filter in report by using another report then i m getting the following error.;
State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 16001] ODBC error state: S1000 code: 1456 message: [Oracle][ODBC][Ora]ORA-01456: may not perform insert/delete/update operation inside a READ ONLY transaction. [nQSError: 16022] A bulkInsert statement has failed after successfully inserted 0 rows but failed in batch 1. Maximum batch size 32768. Current batch size 12 (HY000)
Please suggest me how to overcome this
Regards
Frndsuser652652 wrote:
Hi experts
when i m creating filter in report by using another report then i m getting the following error.;
State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 16001] ODBC error state: S1000 code: 1456 message: [Oracle][ODBC][Ora]ORA-01456: may not perform insert/delete/update operation inside a READ ONLY transaction. [nQSError: 16022] A bulkInsert statement has failed after successfully inserted 0 rows but failed in batch 1. Maximum batch size 32768. Current batch size 12 (HY000)
Please suggest me how to overcome this
Regards
FrndsLooks like u r trying to write back in the database.... The ODBC error message looks like u need more permission for the user trying to perform this..... not clear though...
Edited by: OBIEE+ on Jan 20, 2009 11:50 AM -
Usage Tracking - Cant perform insert operation inside a READ ONLY trans
Hello,
I have been experiencing the following error message when trying to install a row in our s_nq_acct table for USAGE TRACKING:
[nQSError: 16001] ODBC error state: S1000 code: 1456 message: [Oracle][ODBC][Ora]ORA-01456: may not perform insert/delete/update operation inside a READ ONLY transaction.
- I am able to manually insert rows via SQL*Plus whilst logged on as the same user as the Connection Pool
- The Read Only option is not ticked for the ODBC
Can anyone please help me with this?
Thanks,
RhysHi rnm1978,
You were right!
I was being a bit retarded and had to simply switch the call interface on the connection pool to use the OCI and ensure the dta source name was that of the TNS names entry and not the system DSN. -
Test script for syntax without running.
I have always wondered how to do this. Is there any way to have sql*plus check a script for correct syntax and column names, but NOT execute the code. I know that sql*plus doesn't have a TEST option, but it sure would be nice. Currently the only way to check code (especially updating code) is to let it rip and have a rollback at the end. Not the greatest way to do it.
EXPLAIN PLAN will only work for a single SQL statement.
If the script comprises a single transaction, one technique which might work is to first SET TRANSACTION READ ONLY.
This will attempt to execute every line in the script, but any statements which try to update the database will fail with "ORA-01456: may not perform insert/delete/update operation inside a READ ONLY transaction". Similar to what the original post described with a rollback at the end, but without the I/O. -
Hi,
I am trying to use write-back functionality , but I keep getting an error.
- For this template
<?xml version="1.0" encoding="utf-8" ?>
<WebMessageTables xmlns:sawm="com.siebel.analytics.web/message/v1">
<WebMessageTable lang="en-us" system="WriteBack" table="Messages">
<WebMessage name="updatePO">
<XML>
<writeBack connectionPool="agip">
<insert> </insert>
<update>UPDATE dim_purchase_order SET Sole_Source='@{c4}' WHERE Procurement_id=@{c0}
</update>
<postUpdate> COMMIT </postUpdate>
</writeBack>
</XML>
</WebMessage>
</WebMessageTable>
</WebMessageTables>
I am receiving this error:
Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43093] An error occurred while processing the EXECUTE PHYSICAL statement. [nQSError: 16001] ODBC error state: S1000 code: 1456 message: [Oracle][ODBC][Ora]ORA-01456: may not perform insert/delete/update operation inside a READ ONLY transaction. [nQSError: 16015] SQL statement execution failed. (HY000)
SQL Issued: EXECUTE PHYSICAL CONNECTION POOL agip UPDATE dim_purchase_order SET Sole_Source='Yes' WHERE Procurement_id=542
Please help, I need to clarify if it is possible to use write-back in obi se1.
Many thanks,
Lina ForeroHere is an example of xml that works for me
The main difference that I can see, is that I don't use the tag "<postUpdate> COMMIT </postUpdate>"
<?xml version="1.0" encoding="utf-8" ?>
<WebMessageTables xmlns:sawm="com.siebel.analytics.web/message/v1">
<WebMessageTable lang="en-us" system="WriteBack" table="INDICATORI_LUNA">
<WebMessage name="Salarii_Angajati_Writeback">
<XML>
<writeBack connectionPool="WriteBack">
<insert>insert into INDICATORI_LUNA (AN_LUNA, SALARII, NUMAR_ANGAJATI)values(@{c0}, @{c2}, @{c1})</insert>
<update>update INDICATORI_LUNA set SALARII=@{c2}, NUMAR_ANGAJATI=@{c1} where AN_LUNA=@{c0}</update>
</writeBack>
</XML>
</WebMessage>
</WebMessageTable>
</WebMessageTables>
I hope that works.
Best regards
Nicolae Ancuta -
PL/SQL report errors: ORA-01422
Hi all,
(before i you read i would like to say i have searched the net for this error code but nothing shows up like this problem..)
I am getting an error problem when i select certain Schemas from a list on an apex app. page, it only works for some schemas not all..
When i select one schema, it is supposed to display one row.. when i select [ALL] it is supposed to show them all.
It does work if i select '[ALL]' from the select list (p3_schema_name), just not for every single individual one.
the error code:
ORA-01422: exact fetch returns more than requested number of rows
declare
vSchema varchar2(20);
vStmt varchar2(1000);
vVersion number(5);
vDBName varchar2(20);
vHostName varchar2(80);
vStmt2 varchar2(1000);
vVersion2 number(5);
vDBName2 varchar2(20);
vServer2 varchar2(80);
vSchema2 varchar2(80);
CURSOR c_schemas IS
select owner from dba_tables@P3_DB_NAME.db_link where table_name = 'DDL_LOG' and num_rows > 0 order by owner;
begin
IF :P3_SCHEMA_NAME != '[ALL]' AND :P3_DB_NAME IS NOT NULL AND :P3_SERVER_NAME IS NOT NULL THEN
vServer2 := :P3_SERVER_NAME;
vSchema2 := :P3_SCHEMA_NAME;
vStmt2 := 'select distinct DDH_DB_NM, max(DDH_SCHEMA_NR)keep(dense_rank last order by ddh_runstart_td) AS "PATCH" from &P3_SCHEMA_NAME..ddl_log@&P3_DB_NAME.db_link GROUP BY DDH_DB_NM';
Execute Immediate vStmt2 into vDBName2, vVersion2;
htp.p('<br>');
htp.p('<table border="1">');
htp.p('<tr>');
htp.p('<th bgcolor="#FFCC99">SERVER NAME</th>');
htp.p('<th bgcolor="#FFCC99">DB NAME</th>');
htp.p('<th bgcolor="#FFCC99">SCHEMA NAME</th>');
htp.p('<th bgcolor="#FFCC99">PATCH</th>');
htp.p('</tr>');
htp.p('<tr>');
htp.p('<td>');
htp.p(vServer2);
htp.p('</td>');
htp.p('<td>');
htp.p(vDBName2);
htp.p('</td>');
htp.p('<td>');
htp.p(vSchema2);
htp.p('</td>');
htp.p('<td>');
htp.p(vVersion2);
htp.p('</td>');
htp.p('<td>');
htp.p('<BR>');
htp.p('</td>');
htp.p('</tr>');
htp.p('</tr>');
htp.p('</table>');
ELSE IF :P3_SCHEMA_NAME = '[ALL]' AND :P3_DB_NAME IS NOT NULL AND :P3_SERVER_NAME IS NOT NULL THEN
vHostName := :P3_SERVER_NAME;
vDBName := :P3_DB_NAME;
open c_schemas;
htp.p('<br>');
htp.p('<table border="1">');
htp.p('<tr>');
htp.p('<th bgcolor="#FFCC99">SERVER NAME</th>');
htp.p('<th bgcolor="#FFCC99">DB NAME</th>');
htp.p('<th bgcolor="#FFCC99">SCHEMA NAME</th>');
htp.p('<th bgcolor="#FFCC99">PATCH</th>');
htp.p('</tr>');
LOOP
FETCH c_schemas INTO vSchema;
EXIT WHEN c_schemas%NOTFOUND;
vStmt := 'select max(DDH_SCHEMA_NR)keep(dense_rank last order by ddh_runstart_td) AS "PATCH" from '||vSchema||'.ddl_log@&P3_DB_NAME.db_link where DDH_SCHEMA_NR = (select max(DDH_SCHEMA_NR) from '||vSchema||'.ddl_log@&P3_DB_NAME.db_link) and rownum < 2' ;
Execute Immediate vStmt into vVersion ;
htp.p('<tr>');
htp.p('<td>');
htp.p(vHostName);
htp.p('</td>');
htp.p('<td>');
htp.p(vDBName);
htp.p('</td>');
htp.p('<td>');
htp.p(vSchema);
htp.p('</td>');
htp.p('<td>');
htp.p(vVersion);
htp.p('</td>');
htp.p('<td>');
htp.p('<BR>');
htp.p('</td>');
htp.p('</tr>');
END LOOP;
htp.p('</tr>');
htp.p('</table>');
CLOSE c_schemas;
END IF;
END IF;
END;I have checked the DDH_SCHEMA_NR for repeating entries of the highest number.. some of the ones that dont work do have repeating entries some don't.
Sorry if this is confusing, i have tried to explain it as best as i can.
Thanks in advance for any help.
AshleighHello Ashleigh,
Based on your code, I'd start by running this piece of SQL via command-line (thru SQL Workshop, SQL*Plus, Toad, etc.), replacing &P3_SCHEMA_NAME. and &P3_DB_NAME. with values that are currently causing the routine to fail and see if it returns more than one row. I don't know your data, but DISTINCT and GROUP BY are typically used to return multiple (though grouped/summarized) rows. It appears to be the only statement that would cause the error your seeing (more than one row being returned into single variables).
select distinct DDH_DB_NM, max(DDH_SCHEMA_NR)keep(dense_rank last order by ddh_runstart_td) AS "PATCH" from &P3_SCHEMA_NAME..ddl_log@&P3_DB_NAME.db_link GROUP BY DDH_DB_NM;I'm actually surprised that the code runs at all. I didn't think 'execute immediate' would know what to do with substitutions indicated as "&something." (I've typically seen that when substituting in dynamic HTML/Javascript code but maybe I'm learning something new). But since you already have vServer2 and vSchema2, I'd be more apt to code it as:
vStmt2 := 'select distinct DDH_DB_NM, max(DDH_SCHEMA_NR)keep(dense_rank last order by ddh_runstart_td) AS "PATCH" from ' ||
vSchema2 || '.ddl_log@' || vServer2 || '.db_link GROUP BY DDH_DB_NM';Hope this helps,
John -
Ora-00604 error and ora 01000 error while report generation.
hi all,
I am trying to generate the multiple reports of same template through a program.
While this job is running, i get the following error at the BIP console and the reports don't get generated.
[101711_044115578][][EXCEPTION] java.sql.SQLException: ORA-00604: error occurred
at recursive SQL level 1
ORA-01000: maximum open cursors exceeded
ORA-00604: error occurred at recursive SQL level 1
ORA-01000: maximum open cursors exceeded
ORA-01000: maximum open cursors exceeded
Kindly help.
Thanks.Lots of resources with a simple search to see what this is about, for example:
http://www.orafaq.com/wiki/ORA-01000
ORA-01000: maximum open cursors exceeded
Cause: A host language program attempted to open too many cursors. The initialization parameter OPEN_CURSORS determines the maximum number of cursors per user.
Action: Modify the program to use fewer cursors. If this error occurs often, shut down Oracle, increase the value of OPEN_CURSORS, and then restart Oracle.
open_cursors parameter
http://download.oracle.com/docs/cd/E11882_01/server.112/e25513/initparams160.htm#REFRN10137
Oracle support note:
OERR: ORA-1000 maximum open cursors exceeded (Doc ID 18591.1) -
EA2: ORA-01427 clicking on a view in the navigator
SQLDev: 1.5.0.52.03
Java: 1.6.0_04
Oracle: 9.2.0.7.0
I'm getting the following error when I click on a view in the navigator pane:
An error was encountered performing the requested operation:
ORA-01427: single-row subquery returns more than one row 01427. 00000 - "single-row subquery returns more than one row"I'm not seeing any errors in the shell window.
After clicking on <OK> in the error dialog, the normal tabs (Columns, Data, Grants, Dependencies, Details, SQL) are displayed, but there is no content in the Columns tab.
All the other tabs seem to function normally.
Here is the DDL from the SQL tab
CREATE OR REPLACE VIEW "SUBSCRIPTIONS"
"ORDER_ID", "SUNBURST_ORDER_ID", "SIEBEL_ORDER_ID", "ACCOUNT_ID",
"COMP_ID", "SUBACCOUNT_ID", "START_DATE", "END_DATE", "PULL_DATE",
"SUBSCRIPTION_TYPE", "PRICE_CLASS", "DESCRIPTION", "SEAT_COUNT",
"ORDER_DURATION", "CALLBACK_INTERVAL", "UPDATE_DATE", "UPDATE_USERNAME",
"AFFILIATE"
AS
SELECT order_id,
sunburst_order_id,
siebel_order_id,
account_id,
comp_id,
subaccount_id,
start_date,
end_date,
pull_date,
product_id,
price_class,
product_name,
add_users,
order_duration,
callback_interval,
last_mdfy_date,
last_mdfy_emp,
affiliate
FROM csbcrossworlds.subscriptions;We have 15 views in this schema, 3 of them fail this way but the other 12 display the columns just fine. So far I am unable to detect any commonality.
Any ideas?Ok, I think I found the problem. The view in question (SUBSCRIPTIONS) is owned by 'PHILC' and it references a table named 'SUBSCRIPTIONS' owned by 'CSBCROSSWORLDS'. There are two other development schemas that also own tables named 'SUBSCRIPTIONS'.
I believe the 'Columns' tab is executing the query below. The subquery in this SQL tries to identify the primary key columns for the 'SUBSCRIPTIONS' view in my schema (PHILC):
SELECT
c.column_name,
DECODE(
data_type,
'CHAR', data_type||'('||c.data_length||')',
'VARCHAR', data_type||'('||c.data_length||')',
'VARCHAR2', data_type||'('||c.data_length||')',
'NCHAR' , data_type||'('||c.data_length||')',
'NUMBER' , DECODE(c.data_precision,null,'NUMBER', data_type||'('||c.data_precision||','||c.data_SCALE||')'),
'NVARCHAR', data_type||'('||c.data_length||')',
'NVARCHAR2', data_type||'('||c.data_length||')',
data_type) data_type,
DECODE(nullable, 'Y', 'Yes', 'No') nullable,
c.DATA_DEFAULT,
column_id,
com.comments,
(SELECT 1 FROM all_constraints, all_cons_columns
WHERE all_constraints.constraint_type = 'P' AND
all_constraints.constraint_name = all_cons_columns.constraint_name AND
all_constraints.owner = all_cons_columns.owner AND
all_cons_columns.table_name = c.table_name AND
c.column_name = all_cons_columns.column_name) Primary_Key,
c_update.insertable,
c_update.updatable,
c_update.deletable
FROM
sys.all_tab_Columns c, sys.all_col_comments com, sys.user_updatable_columns c_update
WHERE
c.owner = :OBJECT_OWNER AND
c.table_name = :OBJECT_NAME AND
c.table_name = com.table_name AND
c.owner = com.owner AND
c.column_name = com.column_name AND
c_update.column_name = com.column_name AND
c_update.table_name = com.table_name
;Extracting the subquery into this:
SELECT
all_constraints.owner,
all_constraints.table_name,
all_constraints.constraint_name
FROM all_constraints, all_cons_columns
WHERE
all_constraints.constraint_type = 'P' AND
all_constraints.constraint_name = all_cons_columns.constraint_name AND
all_constraints.owner = all_cons_columns.owner and
all_cons_columns.table_name = 'SUBSCRIPTIONS' and
'ORDER_ID' = all_cons_columns.column_name;I got this output:
owner table_name constraint_name
CUTOVER SUBSCRIPTIONS SUBSCRIPTIONS_PK
CROSSWORLDS SUBSCRIPTIONS SUBSCRIPTIONS_PK
CSBCROSSWORLDS SUBSCRIPTIONS SUBSCRIPTIONS_PKLooking at the DDL for the view, the row we really want is for owner 'CSBCROSSWORLDS'. Unfortunately, that means having to somehow parse the SQL text to extract the owner name...
Phil
Maybe you are looking for
-
Will my apps and pictures be saved on Icloud?
I need to reset my Iphone. When I go to reset it to a new Iphone it says all content will be erased. Will all of my apps and pictures be saved on my Icloud? After I reset it how to I access my apps and pictures to download back onto my Iphone?
-
How can I search PDF's with iTunes mini player search?
I have been storeing PDF's in iTunes books becuase its so simple to use. The new mini player in iTunes 11 mini player is amazing and provides some very nice looking searchs. However I can't search PDF's via the mini player. Does anyone know how to ma
-
Downloaded i tunes and Account setup appears in chinese
Hi I've dowloaded the itunes 8.0. I live in australia but bought a laptop as I'm in China and mine had crashed. So I'm running windows vista ulitmate and had the english language package downloaded and updated to the computer. I'm still in china for
-
Using new Numbers (V.3).
Where is it possible to change page margins and enter table name in new Version 3?
-
Problem with colorized grayscale TIFF printing as solid color fill
I have a grayscale TIFF that was created in PSD CS5, placed into an AI CS5 file and then colorized with a PMS color. The resulting effect on screen is correct, but when I go to print, it prints a solid (100%) fill of the PMS where the TIFF image shou