ORA-00913 too many value

Hi DBA's
I have come across the ORA-00913 ,and the scenario is i have create a new tablespace (reclaim_ts) and a user called(reclaim_user), alse grant create session and create table right on the (recalim_ts ) table.
After creating table(t1) now i want to populate this table with this command
INSERT /*+append*/ INTO t1
SELECT rownum, RPAD('x', 1000, 'x')
FROM dual
CONNECT BY level <= 10000;
AFTER THIS I GOT THE =ORA-00913 ERROR
kindly help me out how to fixed this error.
Best Regard's
NEWBIE

hi,
SQL> CREATE TABLE t1 (
  2  id NUMBER,
  3  description VARCHAR2(1000),
  4  CONSTRAINT t1_pk PRIMARY KEY (id)
  5  );
Table created.
SQL> INSERT /*+append*/ INTO t1
  2  SELECT rownum, RPAD('x', 1000, 'x')
  3  FROM dual
  4  CONNECT BY level <= 10000;
10000 rows created.I am not finding issue..can you post across the version of oracle you are using ? or else am i missing any thing
- Pavan kumar N

Similar Messages

  • JDBC receiver error - ORA-00913: too many values

    Hi all,
    Facing a strange issue with proxy-jdbc issue.
    Message fails with error - ORA-00913: too many values
    Handling the missing fields from the source with - Empty String in the comm. Channel
    Empty string handling works fine - whenever there is no value coming form souce, null is inserted into the field value on the DB.
    Trying to insert the same data manually, it works fine. But gives this error END2END.
    When testing END2END, if the field values are made couple of chars less in length, that works fine....fails with the actual data.....seems to be the issue with the field lenghts on the DB.
    Increased all the lengths by 10 chars..still does not work.
    Except the key fields of the DB table, all others are nullable.
    Is there anything else, I am missing...
    Note: Generally, ORA-00913: too many values comes when the number of fields and the number of values donot match in an INSERT/UPDATE statement.
    reg

    Hi
    When testing END2END, if the field values are made couple of chars less in length, that works fine....fails with the actual data.....seems to be the issue with the field lenghts on the DB.
    Increased all the lengths by 10 chars..still does not work
    Well the error you mention generally occurs when the insert statement has more fields mention than in the table .ie you are mentioning extra field .aur this error is due to the field lenght of any of the filed you had to check in the oracle itself  by using the command DESCRIBE there you ll be able to see the field lenght of each and every field .
    hope your problem got resolved :
    Regard's
    Chetan Ahuja

  • Insert ORA-00913: too many values  --  urgent help

    Hi there
    Its pretty urgent, got  stuck up....
    To avoid the undo snapshot error, I am using this procedure to migrate the smaller chunks of  huge volume of  table data into new tables. This below code works well if the columns  are very less. And this procedure is not working if the tables columns are morethan 30 columns and throwing the error   PL/SQL: ORA-00913: too many values
    CREATE OR REPLACE PROCEDURE migration AS
       TYPE array_tp IS TABLE OF tranproc%ROWTYPE;
       l_array array_tp;
       CURSOR c IS
          select * from tranproc p where trunc(date)<=trunc(sysdate)-180;
       l_cnt1 NUMBER :=0;
       l_cnt2 NUMBER :=0;
       l_cnt3 NUMBER :=0;
    BEGIN
       OPEN c;
       LOOP
          FETCH c BULK COLLECT INTO l_array LIMIT 10000;
          EXIT WHEN l_array.COUNT = 0;
          l_cnt1 := c%ROWCOUNT;
          FORALL i IN 1 .. l_array.COUNT
             INSERT INTO TMP_Transpoc VALUES l_array(i);
          l_cnt2 := l_cnt2 + SQL%rowcount;
       END LOOP;
       l_cnt3 := c%ROWCOUNT;
       CLOSE c;
       END;
    16    22    PL/SQL: ORA-00913: too many values
    its falling
    line 16: INSERT INTO TMP_Transpoc VALUES l_array(i);
    Above table i.e tranproc  has around 80 columns .
    i am not pl/sql expert, kindly advise how to resolve it.. i am fine with  alternative approach, just i need a smaller chunk commit.

    Actually, Direct Path does not necessarily require NOLOGGING. If you successfully invoke Direct Path (look for LOAD AS SELECT or DIRECT LOAD INTO in the execution plan) then you are inserting into blocks above the high-water mark (HWM) and there is virtually no UNDO generated for the changes in the table segment.
    However, the index maintenance (if any) will require UNDO, and it may be a lot. If this is going into a new table, then you should be able to create the index after the table is populated.
    Also beware of the NOLOGGING advice. In many cases, an individual SQL statement can not disable logging. And yet, if you do bypass REDO logging, be very sure you understand the consequences for your ability to recover.

  • ORA-00913: too many values when running a Delete

    Hi When I run the both the select statements inlcuding the minus it works,
    but when I run the Delete statement it gives me error ORA-00913: too many values
    Can someone tell me if there is anything I am missing
    DELETE FROM tablename where rowid in
    select rowid,
    to_number(lndr_spcl_allow_int_rate_pct),
    tablename.lndr_spcl_end_prin_bal_amt,
    tablename.lndr_spcl_avg_dly_prin_bal_amt,
    tablename.lndr_spcl_adj_avg_dly_prin_amt,
    tablename.calculated_amt,
    tablename.paid_amt,
    tablename.reported_amt,
    --tablename.processing_date_id, this date changes 
    tablename.date_paid_id,
    tablename.lndr_spcl_allwnc_ctgry_id,
    tablename.affected_period_qtr_date_id,
    tablename.loan_type_id,
    tablename.lndr_id,
    tablename.report_fiscal_qtr_date_id,
    tablename.report_qtr_date_id,
    tablename.lndr_geography_id,
    tablename.lndr_billing_code_id,
    tablename.orig_billing_code,
    tablename.orig_allowance_category,
    tablename.form_id,
    tablename.srvcr_id,
    tablename.document_long_desc,
    tablename.document_date_id,
    tablename.affected_period_qtr_date_desc,
    tablename.document_type
    from tablename
    where lndr_spcl_allow_int_rate_pct not like ('%V%')
    and lndr_spcl_allow_int_rate_pct not like ('N%')
    minus
    select min(rowid),
    to_number(lndr_spcl_allow_int_rate_pct),
    tablename.lndr_spcl_end_prin_bal_amt,
    tablename.lndr_spcl_avg_dly_prin_bal_amt,
    tablename.lndr_spcl_adj_avg_dly_prin_amt,
    tablename.calculated_amt,
    tablename.paid_amt,
    tablename.reported_amt,
    --tablename.processing_date_id, this date changes 
    tablename.date_paid_id,
    tablename.lndr_spcl_allwnc_ctgry_id,
    tablename.affected_period_qtr_date_id,
    tablename.loan_type_id,
    tablename.lndr_id,
    tablename.report_fiscal_qtr_date_id,
    tablename.report_qtr_date_id,
    tablename.lndr_geography_id,
    tablename.lndr_billing_code_id,
    tablename.orig_billing_code,
    tablename.orig_allowance_category,
    tablename.form_id,
    tablename.srvcr_id,
    tablename.document_long_desc,
    tablename.document_date_id,
    tablename.affected_period_qtr_date_desc,
    tablename.document_type
    from tablename
    where lndr_spcl_allow_int_rate_pct not like ('%V%')
    and lndr_spcl_allow_int_rate_pct not like ('N%')
    group by to_number(lndr_spcl_allow_int_rate_pct),
    tablename.lndr_spcl_end_prin_bal_amt,
    tablename.lndr_spcl_avg_dly_prin_bal_amt,
    tablename.lndr_spcl_adj_avg_dly_prin_amt,
    tablename.calculated_amt,
    tablename.paid_amt,
    tablename.reported_amt,
    --tablename.processing_date_id, this date changes 
    tablename.date_paid_id,
    tablename.lndr_spcl_allwnc_ctgry_id,
    tablename.affected_period_qtr_date_id,
    tablename.loan_type_id,
    tablename.lndr_id,
    tablename.report_fiscal_qtr_date_id,
    tablename.report_qtr_date_id,
    tablename.lndr_geography_id,
    tablename.lndr_billing_code_id,
    tablename.orig_billing_code,
    tablename.orig_allowance_category,
    tablename.form_id,
    tablename.srvcr_id,
    tablename.document_long_desc,
    tablename.document_date_id,
    tablename.affected_period_qtr_date_desc,
    tablename.document_type)

    Perhaps this should be your final query ->
    DELETE FROM tablename
    where rowid in (
                      select rowid
                      from tablename
                      where lndr_spcl_allow_int_rate_pct not like ('%V%')
                      and lndr_spcl_allow_int_rate_pct not like ('N%')
                      minus
                      select min(rowid)
                      from tablename
                      where lndr_spcl_allow_int_rate_pct not like ('%V%')
                      and lndr_spcl_allow_int_rate_pct not like ('N%')
                      group by to_number(lndr_spcl_allow_int_rate_pct),
                      tablename.lndr_spcl_end_prin_bal_amt,
                      tablename.lndr_spcl_avg_dly_prin_bal_amt,
                      tablename.lndr_spcl_adj_avg_dly_prin_amt,
                      tablename.calculated_amt,
                      tablename.paid_amt,
                      tablename.reported_amt,
                      --tablename.processing_date_id, this date changes
                      tablename.date_paid_id,
                      tablename.lndr_spcl_allwnc_ctgry_id,
                      tablename.affected_period_qtr_date_id,
                      tablename.loan_type_id,
                      tablename.lndr_id,
                      tablename.report_fiscal_qtr_date_id,
                      tablename.report_qtr_date_id,
                      tablename.lndr_geography_id,
                      tablename.lndr_billing_code_id,
                      tablename.orig_billing_code,
                      tablename.orig_allowance_category,
                      tablename.form_id,
                      tablename.srvcr_id,
                      tablename.document_long_desc,
                      tablename.document_date_id,
                      tablename.affected_period_qtr_date_desc,
                      tablename.document_type
                    );N.B.: Not Tested...
    Regards.
    Satyaki De.

  • ORA-00913: too many values - how to change decimal separator?

    I want to use SQL Developer's database export and need advice how to tweak the decimal separator from , to . in the sql-inserts created.
    Preferrably in SQL Developer, because this error can be easily happen and is hard to catch during import.+
    See below how to reproduce this:
    h3. 1.) ddl (ugly)
    set SERVEROUTPUT on
    CREATE TABLE AADECIMEXPORT
    "DECIMALNUMBER" NUMBER
    , "HUBBABUBBA" varchar2(20 byte)
    CREATE TABLE succeeded.
    h3. 2.) inserts by hand
    insert into AADECIMEXPORT(DECIMALNUMBER,HUBBABUBBA) values(10,'smells integer');
    insert into AADECIMEXPORT(DECIMALNUMBER,HUBBABUBBA) values(3.141592654,'smells rounded pi');
    1 rows inserted
    1 rows inserted
    ¨
    h3. 3.) select * from AADECIMEXPORT
    DECIMALNUMBER HUBBABUBBA
    10 SMELLS INTEGER
    3,141592654 smells rounded pi
    h3. 4.) then use sqldevelopers Tools-"database export" to export this table
    -- File created - tiistai-marraskuu-23-2010
    -- DDL for Table AADECIMEXPORT
    CREATE TABLE "AADECIMEXPORT"
    (     "DECIMALNUMBER" NUMBER,
         "HUBBABUBBA" VARCHAR2(20)
    -- DATA FOR TABLE AADECIMEXPORT
    -- FILTER = none used
    REM INSERTING into AADECIMEXPORT
    Insert into AADECIMEXPORT (DECIMALNUMBER,HUBBABUBBA) values (10,'smells integer');
    Insert into AADECIMEXPORT (DECIMALNUMBER,HUBBABUBBA) values (3,141592654,'smells rounded pi');
    -- END DATA FOR TABLE AADECIMEXPORT
    h3. 5.) Test the insert
    Insert into AADECIMEXPORT (DECIMALNUMBER,HUBBABUBBA) values (3,141592654,'smells rounded pi');
    Error starting at line 49 in command:
    Insert into AADECIMEXPORT (DECIMALNUMBER,HUBBABUBBA) values (3,141592654,'smells rounded pi')
    Error at Command Line:49 Column:12
    Error report:
    SQL Error: ORA-00913: too many values
    00913. 00000 - "too many values"
    *CAUSE:   
    *Action:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    About
    Oracle SQL Developer 2.1.1.64
    Version 2.1.1.64
    Build MAIN-64.45
    Copyright © 2005,2009 Oracle. All Rights Reserved.
    IDE Version: 11.1.1.2.36.55.30
    Product ID: oracle.sqldeveloper
    Product Version: 11.1.1.64.45
    Version
    Component     Version
    =========     =======
    Java(TM) Platform     1.6.0_14
    Oracle IDE     2.1.1.64.45
    Versioning Support     2.1.1.64.45

  • PL/SQL: ORA-00913: too many values

    I don't find out why i'mg getting an "ORA-00913: too many values" Error
    This Example works fine:
    DECLARE
    TYPE session_type IS TABLE OF v$session%ROWTYPE ;
    blocking_sessions session_type;
    BEGIN
    select * bulk collect into blocking_sessions from v$session where blocking_session is not null;
    END;
    But in this Example i'm getting an ORA-00913. Can anybody tell me what i'm doing wrong?
    DECLARE
    TYPE session_type IS TABLE OF v$session%ROWTYPE ;
    blocking_sessions session_type;
    BEGIN
    select distinct blocking_session bulk collect into blocking_sessions from v$session where blocking_session is not null;
    END;
    select distinct blocking_session bulk collect into blocking_sessions from v$session where blocking_session is not null;
    ERROR at line 7:
    ORA-06550: line 7, column 70:
    PL/SQL: ORA-00913: too many values
    ORA-06550: line 7, column 1:
    PL/SQL: SQL Statement ignored

    OK this one works also:
    DECLARE
    TYPE session_type IS TABLE OF NUMBER ;
    blocking_sessions session_type;
    BEGIN
    select distinct blocking_session bulk collect into blocking_sessions from v$session where blocking_session is not null;
    END;
    But when i'm selecting for about 20 columns of a table with 30 columns. Do I have to declare every single column?

  • Error : ORA-00913: too many values

    A subqury inside IN block fetch two id's ( 252621,325645) but the query is erroring out , please tell me what causing this issue
    select comments from oa_rce_bo
    where  e_id in(
    SELECT to_char(ta_id),to_char(id) FROM gdb_s_mtr WHERE ID = TRIM (3049413) OR oa_id = TRIM (3049413)
    )Error : ORA-00913: too many values

    where e_id in(
    SELECT to_char(ta_id),to_char(id) FROM gdb_s_mtr WHERE ID = TRIM (3049413) OR oa_id = TRIM (3049413)
    e_id in should correspond to one column in subquery
    remove one of the column or add another column before in
    like
    where (e_id, someid) in ( your query)
    or
    where e.id in (SELECT to_char(ta_id) FROM gdb_s_mtr WHERE ID = TRIM (3049413) OR oa_id = TRIM (3049413)
    )

  • ORA-00913 too many values issue

    Hi,
    Here is my query,can anyone please suggest where could be wrong in my update query.I am getting error ORA-00913 says too many values in the clause
    update [email protected]
    set processed_flag=1
    WHERE gs_FGCODE='SH' and GS_ID in
    (select ID from [email protected]
    WHERE ID in
    (select hid from [email protected]
    WHERE JAG_NAME='JAGET_ASN_Number' and JAG_VALUE in (
    select CUSTOMER_ID, c.CUST_NAME, SALES_ORG, DIVISION,SHIPMENT_ID,BILL_OF_LADING,
    SAP_PROCESS_DATE SHIP_DATE, SAP_CREATE_DATE, IDOC_NUMBER,
    to_char(IDOC_SENT_DATE), IDOC_LAST_UPDATE_DATE, IDOC_STATUS, IDOC_STATUS_DESC
    from [email protected] a, edit_customer_master c
    where
    c.DIV_CUSTOMER_ID=to_char(to_number(a.CUSTOMER_ID)) and SAP_CREATE_DATE > trunc(sysdate-7) and
    customer_id||DIVISION<>'0010000064GVA' and
    BILL_OF_LADING||DIVISION in (
    select substr(BILL_OF_LADING,1,17)||division from [email protected]
    minus
    select distinct substr(asn_number,1,17)||replace(replace(replace(business_id,63,'LLL'),2,'JJJ'),1,'KKK') from EDIT_OUT_TRANSACTION WHERE business_id not in (3,23) and TRANSACTION_TYPE=856
    Appreciate your any inputs
    TIA,
    RMG

    update [email protected]
    set processed_flag=1
    WHERE gs_FGCODE='SH' and GS_ID in
    (select ID from [email protected]
    WHERE ID in
    (select hid from [email protected]
    WHERE JAG_NAME='JAGET_ASN_Number' and JAG_VALUE in (
    select CUSTOMER_ID, c.CUST_NAME, SALES_ORG, DIVISION,SHIPMENT_ID,BILL_OF_LADING,
    SAP_PROCESS_DATE SHIP_DATE, SAP_CREATE_DATE, IDOC_NUMBER,
    to_char(IDOC_SENT_DATE), IDOC_LAST_UPDATE_DATE, IDOC_STATUS, IDOC_STATUS_DESCfrom [email protected] a, edit_customer_master c
    where
    c.DIV_CUSTOMER_ID=to_char(to_number(a.CUSTOMER_ID)) and SAP_CREATE_DATE > trunc(sysdate-7) and
    customer_id||DIVISION<>'0010000064GVA' and
    BILL_OF_LADING||DIVISION in (
    select substr(BILL_OF_LADING,1,17)||division from [email protected]
    minus
    select distinct substr(asn_number,1,17)||replace(replace(replace(business_id,63,'LLL'),2,'JJJ'),1,'KKK') from EDIT_OUT_TRANSACTION WHERE business_id not in (3,23) and TRANSACTION_TYPE=856
    I think here(bolded part) is the problem.

  • Issue with Oracle Merge statements (PL/SQL: ORA-00913: too many values)

    Hi All,
    I am using the below merge statement and I am getting too many rows issues when I am compiling.
    BEGIN
    FOR te_rec IN ( SELECT /*+ parallel(ts,4) */ te.dtv_acct_num FROM telcos_eligible te, telcos_setup ts, telcos_partners tp
    WHERE tp.telcos_name = UPPER((p_telcos_name))
    AND ts.partner_id = tp.partner_id
    AND te.ts_id = ts.ts_id ) LOOP
    MERGE INTO tcs_accounts
    USING (
    SELECT /*+ DRIVING_SITE(a) */account_id, a.subscriber_id, status, account_type FROM account@tcs_to_paris a WHERE a.subscriber_id = te_rec.dtv_acct_num
    ) paris_accounts
    ON (tcs_accounts.subscriber_id = paris_accounts.subscriber_id)
    WHEN MATCHED THEN
    UPDATE SET
    account_type = paris_accounts.account_type,
    subscriber_id = paris_acounts.subscriber_id,
    status = paris_accounts.status
    WHEN NOT MATCHED THEN
    INSERT(account_id, subscriber_id, status_account_type)
    VALUES(paris_accounts.account_id, paris_accounts.subscriber_id, paris_accounts.status, paris_accounts.account_type);
    END LOOP;
    END;
    Can you let me know what is the issue here.
    Thanks,
    MK.

    Hi,
    Maddy wrote:
    ... WHEN NOT MATCHED THEN
    INSERT(account_id, subscriber_id, status_account_type)
    VALUES(paris_accounts.account_id, paris_accounts.subscriber_id, paris_accounts.status, paris_accounts.account_type);This is one of the many times when a little formatting can really help you. Anybody can forget a column (or have an extra one, or type a _ when they mean ,) but if you write code like this
    INSERT (               account_id,                 subscriber_id,                                  status_account_type)
    VALUES (paris_accounts.account_id,  paris_accounts.subscriber_id,  paris_accounts.status,  paris_accounts.account_type);you might spot the error yourself.
    Always format your code. When you post any formatted text on thsi site, type these 6 characters:
    \(small letters only, inside curly brackets) before and after formatted text, to preserve spacing.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Ora-00913 too many values

    hi ,
    may i know where is my error ?
    INSERT INTO t_Ri_Wk_Claim_Gelm_Xol
    (clm_gelm_xol_mpping_code, clm_gelm_xol_life_assured, clm_gelm_xol_policy_no, clm_gelm_xol_claim_no, clm_gelm_xol_reference_no, clm_gelm_xol_product_code
    , clm_gelm_xol_old_nric_no, clm_gelm_xol_nric_no, clm_gelm_xol_dt_of_birth, clm_gelm_xol_sex, clm_gelm_xol_cover_start_dt, clm_gelm_xol_cover_end_dt, clm_gelm_xol_claim_event_dt, clm_gelm_xol_claim_paid_dt
    , clm_gelm_xol_other_payments, clm_gelm_xol_net_claim_amt, clm_gelm_xol_notifictn_dt, clm_gelm_xol_status_code, clm_gelm_xol_latest_updt_time, clm_gelm_xol_country, clm_gelm_xol_job_date)
    select I_MAPPING_CODE, m_life_assured, m_policy_code, m_claim_prd_info.case_no, m_reference_no, m_product_code
    , m_old_NRIC_code, m_claim_prd_info.NRIC_No, m_birthday, m_gender , i_cover_start_date, i_cover_end_date, m_claim_prd_info.event_date, m_claim_prd_info.paid_date --'[RISAR (reinsured SAR)]'
    ,m_other_payments, m_claim_prd_info.last_update_time, m_claim_prd_info.net_claim_amount, m_claim_prd_info.net_claim_amount, NULL,NULL, m_claim_prd_info.last_update_time,com_flag, NULL
    from dual;
    tks.

    Simply count the number of items in your insert and
    then in your select. They should be the same.
    Insert = 21, select = 23. I'll let you investigate
    what is missing extra...tks hehe.

  • Multiple Selects = Too many values?

    Hi. I have a table of employees, a table of departments (called accounts), and a table containing test results. Every employee is supposed to have a test each year, unless the test was "positive" in a previous year.
    I want a query that lists everyone that hasn't taken the test, but I don't want to include the ones that were "positive".
    I did some incremental query building, making sure each query returned what I wanted before making it more complex (for me). Apologies if I'm providing too much information.
    This returns just the test results that are positive.
    -- Get list of result codes that are positive
    SELECT ResultID FROM Result WHERE ResultTreatAsPositive = 1;
    This returns everyone that has had a positive result at any time.
    -- Get list of people having positive results at any time
    SELECT DISTINCT empID, empFName, empLName, empAcctNum, actDescription
    FROM Employee, Account, TestResult
    WHERE empID = testEmployeeID
    AND empAcctNum = actNumber
    AND empActive = 1
    AND testResult IN (SELECT ResultID FROM Result WHERE ResultTreatAsPositive = 1)
    ORDER BY actDescription;
    This returns everyone that had a test during the previous year
    -- Get everyone having any results during date range
    SELECT DISTINCT empID, empFName, empLName, empAcctNum, actDescription
    FROM Employee, Account, TestResult
    WHERE empID = testEmployeeID
    AND empAcctNum = actNumber
    AND testReadDate BETWEEN to_date('2005/01/01', 'yyyy/mm/dd') AND to_date('2005/12/31', 'yyyy/mm/dd')
    AND empActive = 1
    ORDER BY actDescription;
    So far, so good. However, when I try to put all of these together, I get errors:
    This should return all employees minus ones with a positive result (at any time) and minus any test taken this year
    -- Get everyone else
    SELECT DISTINCT empID, empFName, empLName, empTitle, empAcctNum, actDescription
    FROM Employee, Account, TestResult
    WHERE empID = testEmployeeID
    AND empAcctNum = actNumber
    AND empActive = 1
    AND (empID NOT IN (SELECT DISTINCT empID, empFName, empLName, empAcctNum, actDescription FROM Employee, Account, TestResult WHERE empID = testEmployeeID AND empAcctNum = actNumber AND empActive = 1 AND testResult IN (SELECT ResultID FROM Result WHERE ResultTreatAsPositive = 1)))
    AND (empID NOT IN (SELECT DISTINCT empID, empFName, empLName, empAcctNum, actDescription FROM Employee, Account, TestResult WHERE empID = testEmployeeID AND empAcctNum = actNumber AND testReadDate BETWEEN to_date('1988/01/01', 'yyyy/mm/dd') AND to_date('2007/01/01', 'yyyy/mm/dd') AND empActive = 1))
    ORDER BY actDescription, empLName, empFName;
    I get ERROR at line 6: (my first empID NOT IN line)
    ORA-00913: too many values.
    How can I write this query so that it works? Any tips are appreciated, even those that point out I can't write a query very well!
    --G                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Missed that one and was thrown off by those 2005, 1998, 2007 dates …
    Looks like you’re on the right track though.Sorry. I cobbled that code from some of my tests (grab everything -- seeing multiple rows makes me feel better!)
    Looking at your suggestion on TRUNC, I can't really do that, as user can specify everyone that doesn't qualify for a single month -- apparently, some departments are assigned a month to have their tests, while others can go the entire year.
    Thanks for the help.
    --G                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • ROWTYPE and "Too many values" error...

    I'm in the middle of trying to understand the inner workings of %ROWTYPE and how I can copy the structure of a table with it. I think I'm understanding the gist of it, but I continue to fail in pinpointing the actual values I try to insert with an example tutorial I'm using at the moment and was hoping someone could help me understand my problem better so that I can bridge this mental gap I seem to be slipping into...
    That said, I have the following table: ct_employee
    The columns of this table (and their schema settings) are as follows:
    empno - NUMBER(4,0)
    ename - VARCHAR2(20)
    job - VARCHAR2(20)
    mgr - NUMBER(4,0)
    hiredate - DATE
    sal - NUMBER(7,2)
    comm - NUMBER(7,2)
    ct_department - NUMBER(2,0)The SQL I'm using in all this is the following:
    SET VERIFY OFF
    DEFINE emp_num = 7369;
    DECLARE
      emp_rec ct_retired_emps%ROWTYPE;
    BEGIN
      SELECT *
      INTO emp_rec
      FROM ct_employee
      WHERE empno = &emp_num;
      emp_rec.leavedate := SYSDATE;
      UPDATE ct_retired_emps SET ROW = emp_rec
      WHERE empno = &emp_num;
    END;As I hope you can tell from the above, I'm trying to create a variable (emp_rec) to store the structure of ct_employee where upon I then copy a record into emp_rec if and only if the empno column from ct_employee matches that of the emp_num "7369".
    I'm using SQL*PLUS with 10g in all this (+a program I love, by the way; it's really easy to use and very informative+) and when I press the "Run Script" button, I receive the following Script Output:
    Error report:
    ORA-06550: line 6, column 3:PL/SQL: ORA-00913: too many values
    ORA-06550: line 4, column 3:
    PL/SQL: SQL Statement ignored
    06550. 00000 - "line %s, column %s:\n%s"
    *Cause:    Usually a PL/SQL compilation error.
    *Action:>
    What I translate from this is that there's either a column number mismatch or else there's some value being attempted to be inserted into the variable I created that isn't matching the structure of the variable.
    Anyway, if someone around here could help me with this, you would make my day.

    It's still not updating the table. :(
    Here's where I am...
    I currently have the following pl/sql:
    SET VERIFY OFF
    DEFINE emp_num = 7369;
    DECLARE
      emp_rec ct_retired_emps%ROWTYPE;
    BEGIN
      SELECT *
      INTO emp_rec
      FROM ct_employee
      WHERE empno = &emp_num;
      emp_rec.leavedate := SYSDATE;
      UPDATE ct_retired_emps SET ROW = emp_rec
      WHERE empno = &emp_num;
    END;I'm trying to avoid as much hard-coding as possible, hence my use of the all selector, but because of this, SQL*Plus is now giving me a run-time error of the following:
    Error report:ORA-06550: line 6, column 3:
    PL/SQL: ORA-00913: too many values
    ORA-06550: line 4, column 3:
    PL/SQL: SQL Statement ignored
    06550. 00000 - "line %s, column %s:\n%s"
    *Cause:    Usually a PL/SQL compilation error.
    *Action:>
    So to remedy this, I then try the following revised PL/SQL:
    SET VERIFY OFFDEFINE emp_num = 7369;
    DECLARE
    emp_rec ct_retired_emps%ROWTYPE;
    BEGIN
    SELECT empno, ename, job, mgr, hiredate, SYSDATE as leavdate, sal, comm, ct_department
    INTO emp_rec
    FROM ct_employee
    WHERE empno = &emp_num;
    UPDATE ct_retired_emps SET ROW = emp_rec
    WHERE empno = &emp_num;
    END;>
    This time, everything runs smoothly, however, no information is updated into the ct_retired_emps! Ha!
    I've verified that there's a record in ct_employee that has "7369" for its empno column value, so there should be no missing value concern from all this. The only other thing I can think of is that there must be something askew with my logic, but as to what, I have no clue. Below are my columns for both tables:
    ct_employee -
    empno, ename, job, mgr, hiredate, sal, comm, ct_department
    ct_retired_emps -
    empno, ename, job, mgr, hiredate, leavedate, sal, comm, deptno
    My immediate questions:
    1.) I know nothing about debugging or troubleshooting PL/SQL, but I do know that I need to review the contents of the emp_rec variable above to see what all is inside it so that I can better assess what's going on here. I've tried to use DBMS_OUTPUT.PUT_LINE(emp_rec) but this does nothing and only creates another run-time error. What's a way in which I can output the contents of this regardless of run-time success? Would I need to code in an EXCEPTION section and THEN use DBMS_OUTPUT...?
    2.) SELECTING * in the first snippet above meant that I was disallowed the use of the emp_rec.leavedate := SYSDATE; after the SELECT. How might oneself SELECT * AND+ use emp_rec.leavedate := SYSDATE; in the same EXECUTION section?
    3.) With everything I've provided here, do you see any obvious issues?
    It doesn't take a genius to realize I'm new at this stuff, but I am trying to provide everything I can to learn here so if any of you can help this poor guy out, he'd be very grateful.

  • Too many values when trying insert records by bulk collect

    Hi
    Can anyone advice on the bulk collect error please?
    Following is my code where I am getting too many values error...
    TYPE p_empid_type IS TABLE OF emp%ROWTYPE;
          v_empid               p_empid_type;
       BEGIN
          SELECT DISTINCT emp_id , 'ABC'
          BULK COLLECT INTO v_empid
                     FROM emp
                    WHERE empid IN (SELECT ord_id
                                       FROM table_x
                                      WHERE column_x = 'ABC');
          FORALL i IN v_empid.FIRST .. v_empid.LAST
             INSERT INTO my_table
                  VALUES v_empid(i);
          COMMIT;
    PL/SQL: ORA-00913: too many values in line - BULK COLLECT INTO v_empid

    Hello, since you're SELECTing a constant string, why not:
    TYPE p_empid_type IS TABLE OF INTEGER;
          v_empid               p_empid_type;
       BEGIN
          SELECT DISTINCT emp_id
          BULK COLLECT INTO v_empid
                     FROM emp
                    WHERE empid IN (SELECT ord_id
                                       FROM table_x
                                      WHERE column_x = 'ABC');
          FORALL i IN v_empid.FIRST .. v_empid.LAST
             INSERT INTO my_table
                  VALUES v_empid(i), 'ABC';
    Edit Untested: may not work
    This would be the best BULK COLLECT of all:
    INSERT /*+ APPEND */ INTO my_table
    SELECT DISTINCT emp_id , 'ABC'
      FROM emp
    WHERE empid IN (SELECT ord_id
          FROM table_x
         WHERE column_x = 'ABC');
          COMMIT;

  • Getting ORA-06512: at "SYS.UTL_HTTP", line 1022 ORA-29270: too many open

    hi
    I am getting the following error while calling the procedure in the batch process
    ORA-06512: at "SYS.UTL_HTTP", line 1022
    ORA-29270: too many open HTTP requests
    Could you please help me on this? As this is getting affected in the live databases.
    ORA-06512: at "SYS.UTL_HTTP", line 1022
    ORA-29270: too many open HTTP requests
    CREATE OR REPLACE PROCEDURE Send_To_Spg(
    PTRANSACTION_ID               IN          VARCHAR2,
    PCHANNEL_TYPE               IN VARCHAR2 DEFAULT NULL,
    PCSS_ORDER_NUMBER          IN VARCHAR2 DEFAULT NULL,
    PTELEPHONE_NUMBER          IN VARCHAR2 DEFAULT NULL,
    PSCENARIO_TYPE               IN VARCHAR2 DEFAULT NULL,
    PCUSTOMER_REQUIRED_DATE IN          VARCHAR2 DEFAULT NULL,
    PCUSTOMER_REQUIRED_TIME IN          VARCHAR2 DEFAULT NULL,
    PCANCELLATION_REASON     IN          VARCHAR2 DEFAULT NULL,
    PCANCELLATION_NOTES          IN          VARCHAR2 DEFAULT NULL,
    PSMPF_RETENTION               IN          VARCHAR2 DEFAULT NULL,
    PEMERGENCY_WINBACK          IN          VARCHAR2 DEFAULT NULL,
    PCSS_PROJECT_ID               IN          VARCHAR2 DEFAULT NULL,
    PCSS_ORDER_NOTES          IN          VARCHAR2 DEFAULT NULL,
    PREASON_FOR_CESSATION     IN          VARCHAR2 DEFAULT NULL,
    P_RESPONSE                    OUT VARCHAR2,
    PSMART_USER_ID               IN VARCHAR2 DEFAULT NULL,
    PORACLE_ERROR               OUT VARCHAR2,
    PORACLE_ERROR_MESSAGE     OUT          VARCHAR2,
    PRESPONSE_TIME               OUT          NUMBER,
    PDATA_TRANSFER_STATUS     OUT          VARCHAR2)
    IS
    v_scenario_type               VARCHAR2(20); -- Varialble to Hold Time Out of every request to SPG
    v_transaction_time          NUMBER;          -- Total time in which Request to SPG was processed
    v_record_inserted_at     DATE;          -- Date/Time about the record insertion to the Error Handler
    v_start_time               NUMBER;          -- Variable to hold Start Time for calculationg Transaction Time
    v_url                         VARCHAR2(32767);-- URL to use when sending data to SPG
    vtransaction_id               VARCHAR2(18); -- Variable to hold Transaction ID for the request
    v_buffer                    VARCHAR2(32760);-- Variable to read response from the SPG interface
    v_timeout                    PLS_INTEGER; -- Time Out for each Transaction
    v_oracle_err_msg          VARCHAR2(600); -- Variable to hold Oracle Error Message
    v_resp                UTL_HTTP.RESP; -- Response Object
    v_req                UTL_HTTP.REQ; -- Request Object
    v_userid_pwd               SMT_ORACLE_PARAMETERS%ROWTYPE; --Variable declared to contain User ID & Password
    vl_RetCode          VARCHAR2(5000);
    vl_std_returnCode     VARCHAR2(3000);
    --PDATA_TRANSFER_STATUS Holds the Data Transfer Status which can have possible values as
    -- N => Data Has not been sent to SPG
    -- Y => Received Successful response from SPG
    -- F => On the First try to Send data to SPG Oracle Error Occured or response from SPG was a faulure
    -- S => On the Second try to Send data to SPG Oracle Error Occured or response from SPG was a faulure
    -- T => Data Has been transferred to the Error Log Table
    -- X => Data need not be transfered to Error Log Table.
    --Location of the timeout, URL & User Id & Password in Standing Data.
    c_url_stopwlr SMT_ORACLE_PARAMETERS.PARAMETER_CODE%TYPE:='SPG_WLR';-- Stop WLR URL
    c_url_cancelown SMT_ORACLE_PARAMETERS.PARAMETER_CODE%TYPE:='SPG_OWN';-- Cancel own URL
    c_url_cancelother SMT_ORACLE_PARAMETERS.PARAMETER_CODE%TYPE:='SPG_OTH';-- Cancel other URL
    c_url_amendcrd SMT_ORACLE_PARAMETERS.PARAMETER_CODE%TYPE:='SPG_CRD';--Amend CRD URL
    c_spg_useridpwd SMT_ORACLE_PARAMETERS.PARAMETER_CODE%TYPE:='SPGIDPWD'; --Contains user id and pwd
    ctimeout smt_parameters.parameter_code%TYPE:='SPGTO'; --This holds the timeout parameter
    BEGIN
         --In case the calling batch process can pass this value this SQL read will not be required & can be deleted
         --Read data transfer status for the transaction Id
         SELECT data_transfer_status INTO PDATA_TRANSFER_STATUS     FROM SPG_INTERFACE_TABLE
         WHERE transaction_id     =     PTRANSACTION_ID;
         --Record the start time
         v_start_time:=DBMS_UTILITY.GET_TIME;
         --If Data transfer status is S then send the record to error handler
         IF PDATA_TRANSFER_STATUS = 'S' THEN
              Error_Handler(PTRANSACTION_ID,PSMART_USER_ID,PORACLE_ERROR,PORACLE_ERROR_MESSAGE,v_record_inserted_at,PDATA_TRANSFER_STATUS);
         ELSE
         --In case Data Tranfer Status is something other than S then send the request to SPG
              --Initialise other variables which will be populated during the journey
              P_RESPONSE                    :=     '';
              PORACLE_ERROR               :=     NULL;
              PORACLE_ERROR_MESSAGE     :=     NULL;
              PRESPONSE_TIME               :=     0;
         --Read timeout parameter from standing data.
              BEGIN
                   SELECT VALUE INTO v_timeout FROM smt_parameters WHERE parameter_code=ctimeout;
              EXCEPTION
                   WHEN NO_DATA_FOUND THEN
                   v_timeout:=30;
              WHEN OTHERS THEN
                   v_timeout:=30;
              END;
         -- Construct the URL for Stop WLR Scenario
              IF PSCENARIO_TYPE = 'STOP_WLR' THEN
                   BEGIN
                   -- Read the Initial URL from Standing Data
                   SELECT VALUE
                        INTO v_url
                        FROM SMT_ORACLE_PARAMETERS
                        WHERE parameter_code = c_url_stopwlr
                        AND host_id = ( SELECT host_id
                                                      FROM SMART_HOSTS A
                                                      WHERE EXISTS ( SELECT 1
                                                                     FROM DB_PARAMETERS b
                                                                     WHERE A.hostname = b.hostname
                                                                     AND A.database_id = b.database_id));
                   --handle unforseen exception
                   EXCEPTION
                   WHEN NO_DATA_FOUND THEN
                        v_url:='Http://wls.brassi1c.devenv1.bt.co.uk:64738/pls/spgenv/spg_btrc.add_btrc_winback_details'; --After testing the same, URL will be fetched from the Query
                   WHEN OTHERS THEN
                        v_url:='Http://wls.brassi1c.devenv1.bt.co.uk:64738/pls/spgenv/spg_btrc.add_btrc_winback_details'; --After testing the same, URL will be fetched from the Query
                   END;
                   --construct the URL depending on the parameters to be passed to the url
                   v_url := v_url || '?';
                   v_url := v_url || 'p_data_entered=' || Smart_Urlencode('xmloverhttp') || '&';
                   v_url := v_url || 'p_channel_type=' || Smart_Urlencode(PCHANNEL_TYPE)|| '&';
                   v_url := v_url || 'p_css_start_order_no=' || Smart_Urlencode(PCSS_ORDER_NUMBER)|| '&';
                   v_url := v_url || 'p_tel_no=' || Smart_Urlencode(PTELEPHONE_NUMBER)|| '&';
                   v_url := v_url || 'p_crd=' || Smart_Urlencode(PCUSTOMER_REQUIRED_DATE)|| '&';
                   v_url := v_url || 'p_take_over_time=' || Smart_Urlencode(PCUSTOMER_REQUIRED_TIME)|| '&';
                   v_url := v_url || 'p_retainsmpf=' || Smart_Urlencode(PSMPF_RETENTION)|| '&';
                   --v_url := v_url || 'p_emergency_winback='                    || Smart_Urlencode(PEMERGENCY_WINBACK)|| '&';
                   v_url := v_url || 'p_projectno=' || Smart_Urlencode(PCSS_PROJECT_ID)|| '&';
                   v_url := v_url || 'p_ordernotes=' || Smart_Urlencode(PCSS_ORDER_NOTES)|| '&';
                   v_url := v_url || 'p_reason_cessation=' || Smart_Urlencode(PREASON_FOR_CESSATION);
              ELSIF PSCENARIO_TYPE='CANCEL_OWN' THEN
              --Fetch the URL for cancel own from standing data.
                   BEGIN
                        SELECT VALUE
                        INTO v_url
                        FROM SMT_ORACLE_PARAMETERS
                        WHERE parameter_code = c_url_cancelown
                        AND host_id = ( SELECT host_id
                                                      FROM SMART_HOSTS A
                                                      WHERE EXISTS ( SELECT 1
                                                                     FROM DB_PARAMETERS b
                                                                     WHERE A.hostname = b.hostname
                                                                     AND A.database_id = b.database_id));
              --handle unforseen exception
                   EXCEPTION
                             WHEN NO_DATA_FOUND THEN
                             v_url := 'Http://wls.brassi1c.devenv1.bt.co.uk:64738/pls/spgenv/spg_btrc.add_btrc_cancelown_details'; --After testing the same, URL will be fetched from the Query
                   WHEN OTHERS THEN
                             v_url := 'Http://wls.brassi1c.devenv1.bt.co.uk:64738/pls/spgenv/spg_btrc.add_btrc_cancelown_details'; --After testing the same, URL will be fetched from the Query
                   END;
              --construct the URL
              v_url := v_url || '?';
              v_url := v_url || 'p_data_entered=' ||Smart_Urlencode('xmloverhttp')|| '&';
              v_url := v_url || 'p_channel_type=' ||Smart_Urlencode(PCHANNEL_TYPE)|| '&';
              v_url := v_url || 'p_css_start_order_no=' ||Smart_Urlencode(PCSS_ORDER_NUMBER)|| '&';
              v_url := v_url || 'p_tel_no=' ||Smart_Urlencode(PTELEPHONE_NUMBER)|| '&';
              v_url := v_url || 'p_cancel_reason=' ||Smart_Urlencode(PCANCELLATION_REASON)|| '&';
              v_url:= v_url || 'p_cancel_notes=' ||Smart_Urlencode(PCANCELLATION_NOTES);
              ELSIF PSCENARIO_TYPE='CANCEL_OTHER' THEN
              --Fetch the URL for cancel own from standing data.
              BEGIN
              SELECT VALUE
                        INTO v_url
                        FROM SMT_ORACLE_PARAMETERS
                        WHERE parameter_code = c_url_cancelother
                        AND host_id = ( SELECT host_id
                                                      FROM SMART_HOSTS A
                                                      WHERE EXISTS ( SELECT 1
                                                                     FROM DB_PARAMETERS b
                                                                     WHERE A.hostname = b.hostname
                                                                     AND A.database_id = b.database_id));
              --handle unforseen exception
              EXCEPTION
                   WHEN NO_DATA_FOUND THEN
                        v_url := 'Http://wls.brassi1c.devenv1.bt.co.uk:64738/pls/spgenv/spg_btrc.add_btrc_cancelother_details'; --After testing the same, URL will be fetched from the Query
                   WHEN OTHERS THEN
                        v_url := 'Http://wls.brassi1c.devenv1.bt.co.uk:64738/pls/spgenv/spg_btrc.add_btrc_cancelother_details'; --After testing the same, URL will be fetched from the Query
              END;
              --construct the URL
              v_url := v_url || '?';
              v_url := v_url || 'p_data_entered=' ||Smart_Urlencode('xmloverhttp')|| '&';
              v_url := v_url || 'p_channel_type=' ||Smart_Urlencode(PCHANNEL_TYPE)|| '&';
              v_url := v_url || 'p_css_stop_order_no=' ||Smart_Urlencode(PCSS_ORDER_NUMBER)|| '&';
              v_url := v_url || 'p_tel_no=' ||Smart_Urlencode(PTELEPHONE_NUMBER)|| '&';
              v_url := v_url || 'p_cancel_reason=' ||Smart_Urlencode(PCANCELLATION_REASON);
              ELSIF Pscenario_type='AMEND_CRD' THEN
              --Fetch the URL for cancel own from standing data.
              BEGIN
              SELECT VALUE
                        INTO v_url
                        FROM SMT_ORACLE_PARAMETERS
                        WHERE parameter_code = c_url_amendcrd
                        AND host_id = ( SELECT host_id
                                                      FROM SMART_HOSTS A
                                                      WHERE EXISTS ( SELECT 1
                                                                     FROM DB_PARAMETERS b
                                                                     WHERE A.hostname = b.hostname
                                                                     AND A.database_id = b.database_id));
              --handle unforseen exception
              EXCEPTION
              WHEN NO_DATA_FOUND THEN
                   v_url := 'Http://wls.brassi1c.devenv1.bt.co.uk:64738/pls/spgenv/spg_btrc.add_btrc_amendcrd_details'; -- After testing the same , URL will be fetched from the Query
              WHEN OTHERS THEN
                   v_url := 'Http://wls.brassi1c.devenv1.bt.co.uk:64738/pls/spgenv/spg_btrc.add_btrc_amendcrd_details'; -- After testing the same , URL will be fetched from the Query
              END;
              --construct the URL
              v_url := v_url || '?';
              v_url := v_url || 'p_data_entered=' ||Smart_Urlencode('xmloverhttp')|| '&';
              v_url := v_url || 'p_channel_type=' ||Smart_Urlencode(PCHANNEL_TYPE)|| '&';
              v_url := v_url || 'p_css_start_order_no=' ||Smart_Urlencode(PCSS_ORDER_NUMBER)|| '&';
              v_url := v_url || 'p_tel_no=' ||Smart_Urlencode(PTELEPHONE_NUMBER)|| '&';
              v_url := v_url || 'p_crd='                         ||Smart_Urlencode(PCUSTOMER_REQUIRED_DATE)|| '&';
              v_url := v_url || 'p_css_change_order_numbers='||Smart_Urlencode(PCANCELLATION_REASON);
              END IF;
              --this is start of setting parameters for utl http object. the show begins...
              utl_http.set_transfer_timeout(v_timeout);
              --Set the wallet
              --XXXXX e.g.UTL_HTTP.SET_WALLET(?file:DirectoryPath?,'put password here?);
              --Set proxy
              --YYYYY e.g. utl_http.set_proxy(p_proxy_in, p_no_proxy_domains_in);
              v_url := REPLACE(v_url,'%27%27','%27'); -- Fix to ensure Double Quotes are converted to Single Quotes
              --set the required URL to utl http.
              v_req := utl_http.begin_request(v_url);
              --Authentication setting
              --Fetch the user id and password from stnding data.
              BEGIN
                   SELECT *
                        INTO v_userid_pwd
                        FROM SMT_ORACLE_PARAMETERS
                        WHERE PARAMETER_CODE=c_spg_useridpwd
                        AND HOST_ID = ( SELECT HOST_ID
                                            FROM SMART_HOSTS A
                                            WHERE EXISTS ( SELECT 1
                                                                FROM DB_PARAMETERS B
                                                                WHERE A.HOSTNAME = B.HOSTNAME
                                                                AND A.DATABASE_ID = B.DATABASE_ID));
              EXCEPTION
                   WHEN NO_DATA_FOUND THEN
                   P_RESPONSE := 'ORACLE_ERROR: USER id AND Password NOT configured IN SMT_ORACLE_PARAMETERS:SPGIDPWD';
                   WHEN OTHERS THEN
                   P_RESPONSE := 'ORACLE_ERROR: USER id AND Password NOT configured IN SMT_ORACLE_PARAMETERS:SPGIDPWD';
              END;
              --utl_http.set_authentication(v_req, p_username_in, p_password_in);
              utl_http.set_authentication(v_req, v_userid_pwd.description, v_userid_pwd.VALUE);
              v_resp := utl_http.get_response(v_req);
              --Fill in the the response time
              PRESPONSE_TIME := (DBMS_UTILITY.GET_TIME - v_start_time)/100;
              IF v_resp.reason_phrase = 'OK' THEN
                   -- Fetch the response
                   BEGIN
                        LOOP
                        utl_http.read_line(v_resp, v_buffer);
                             P_RESPONSE := P_RESPONSE || v_buffer;
                        END LOOP;
                             utl_http.end_response(v_resp);
                        EXCEPTION
                        WHEN utl_http.end_of_body THEN
                        utl_http.end_response(v_resp);
                        P_RESPONSE := P_RESPONSE || v_buffer;
                   END;
              ELSIF v_resp.reason_phrase <> 'OK' OR P_RESPONSE = '' THEN
                   --error handling starts
                   --If the HTTP Status is not OK then store the error information
                   PORACLE_ERROR_MESSAGE     :=     'Status Code: '|| v_resp.STATUS_CODE||'. Reason Phrase ' ||v_resp.reason_phrase;
                   P_RESPONSE                    :=     'ORACLE_ERROR: '||     ' Reason Phrase ' ||     v_resp.reason_phrase;
                   PORACLE_ERROR               :=     v_resp.STATUS_CODE;
              END IF;
              --In case we got successful response from SPG
              IF P_RESPONSE LIKE '%<RetCde>0</RetCde>%' THEN
                   PDATA_TRANSFER_STATUS     :=     'Y';
              ELSE
                   BEGIN
    SELECT message
                                  INTO vl_std_returnCode
                                  FROM SMT_MESSAGES
                                  WHERE MESSAGE_CODE='SPGANTIDTS';
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
         vl_std_returnCode := '-12545,-29273,-1,401,';
    WHEN OTHERS THEN
                        vl_std_returnCode := '-12545,-29273,-1,401,';
    END;
                   --In case there was an error do not update Data Transfer Status
                   IF PORACLE_ERROR <> NULL AND INSTR(vl_std_returnCode, PORACLE_ERROR || ',', 1, 1) <> 0 THEN
                             PDATA_TRANSFER_STATUS:=PDATA_TRANSFER_STATUS;
                   ELSE
                        vl_RetCode := SUBSTR(P_RESPONSE, INSTR(P_RESPONSE,'<RetCde>', 1, 1),
                        INSTR(P_RESPONSE,'</RetCde>',1,1)+9 - INSTR(P_RESPONSE,'<RetCde>', 1, 1));
                        BEGIN
                             SELECT VALUE
                                  INTO vl_std_returnCode
                                  FROM SMT_ORACLE_PARAMETERS
                                  WHERE PARAMETER_CODE='SPGRCS'
                                  AND HOST_ID = ( SELECT HOST_ID
                                       FROM SMART_HOSTS A
                                       WHERE EXISTS ( SELECT 1
                                                           FROM DB_PARAMETERS B
                                                           WHERE A.HOSTNAME = B.HOSTNAME
                                                           AND A.DATABASE_ID = B.DATABASE_ID));
                   EXCEPTION
                        WHEN NO_DATA_FOUND THEN
                             vl_std_returnCode := '<RetCde>4244</RetCde><RetCde>4245</RetCde><RetCde>4246</RetCde>';
                        WHEN OTHERS THEN
                             vl_std_returnCode := '<RetCde>4244</RetCde><RetCde>4245</RetCde><RetCde>4246</RetCde>';
                        END;
                        IF INSTR(vl_std_returnCode, vl_RetCode, 1, 1) <> 0 THEN
                             --needs not to re attempted.
                             PDATA_TRANSFER_STATUS:='X';
                        ELSE
                             --In case we did'nt got SUCCESSFUL response FROM SPG THEN UPDATE the Data Transfer Status so that the failed requests can be picked up BY the NEXT batch job RUN
                             IF PDATA_TRANSFER_STATUS='N' THEN
                                  --initially if data transfer status was N then update it now to F
                                  PDATA_TRANSFER_STATUS     :=     'F';
                             ELSIF PDATA_TRANSFER_STATUS='F' THEN
                                  --initially if data transfer status was N then update it now to S
                                  PDATA_TRANSFER_STATUS     :=     'S';
                             END IF;
                        END IF;
                   END IF;
              END IF;
              --Now Update all the modified Values
         UPDATE SPG_INTERFACE_TABLE
                   SET     response          =     P_RESPONSE,
                   data_transfer_status     =     PDATA_TRANSFER_STATUS,
                   oracle_error               =     PORACLE_ERROR,
                   oracle_error_message     =     PORACLE_ERROR_MESSAGE,
                   response_time               =     PRESPONSE_TIME
                   WHERE transaction_id     =     PTRANSACTION_ID;
              COMMIT;
    END IF;
    EXCEPTION
         WHEN OTHERS THEN
         --Handling the unhandled exception
         PORACLE_ERROR               :=     SQLCODE;
         PORACLE_ERROR_MESSAGE     :=     SQLERRM;
         P_RESPONSE                    :=     'ORACLE_ERROR: '|| PORACLE_ERROR_MESSAGE;
         PRESPONSE_TIME               :=     (DBMS_UTILITY.GET_TIME - v_start_time)/100;
         SELECT data_transfer_status INTO PDATA_TRANSFER_STATUS
         FROM SPG_INTERFACE_TABLE
         WHERE transaction_id=PTRANSACTION_ID;
         --New functionality to update the oracle error and oracle error message and not the Data Transfer Status
    BEGIN
    SELECT message
    INTO vl_std_returnCode
    FROM SMT_MESSAGES
    WHERE MESSAGE_CODE='SPGANTIDTS';
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    vl_std_returnCode := '-12545,-29273,-1,';
    WHEN OTHERS THEN
    vl_std_returnCode := '-12545,-29273,-1,';
    END;
         vl_RetCode     :=     PORACLE_ERROR || ',';
    IF INSTR(vl_std_returnCode, vl_RetCode, 1, 1) <> 0 THEN
    --If the error is found in above maintained standing data do not change the Data Transfer Status
                   pdata_transfer_status:=pdata_transfer_status;
    ELSE
              IF pdata_transfer_status='N' THEN
                             PDATA_TRANSFER_STATUS     :=     'F';
                             DBMS_OUTPUT.PUT_LINE('DUE TO ERROR DATA COULDN''T GET TRANSFERED TO SPG FOR TRANSACTION'||' '||PTRANSACTION_ID);
                             DBMS_OUTPUT.PUT_LINE(SQLERRM);
              ELSIF pdata_transfer_status='F' THEN
                             PDATA_TRANSFER_STATUS     :=     'S';
                             DBMS_OUTPUT.PUT_LINE('DUE TO ERROR DATA COULDN''T GET TRANSFERED TO SPG FOR TRANSACTION'||' '||PTRANSACTION_ID);
                             DBMS_OUTPUT.PUT_LINE(SQLERRM);
    ELSE
                             DBMS_OUTPUT.PUT_LINE('Failure WHEN sending data TO Error LOG. Data Transfer Status IS ' || PDATA_TRANSFER_STATUS || '. TRANSACTION ID '|| PTRANSACTION_ID);
              END IF;
    END IF;
              --Now update all the information gathered above to the table
         UPDATE SPG_INTERFACE_TABLE
              SET     response          =     P_RESPONSE,
              data_transfer_status     =     PDATA_TRANSFER_STATUS,
              oracle_error               =     PORACLE_ERROR,
              oracle_error_message     =     PORACLE_ERROR_MESSAGE,
              response_time               =     PRESPONSE_TIME
              WHERE transaction_id     =     PTRANSACTION_ID;
              COMMIT;
    END;
    /

    I have fixed the problem by own.
    Seems there are some while space in the endpoint url.
    Fix
    http_req:= utl_http.begin_request
    trim(l_endpoint_url)
    ,'POST'
    ,'HTTP/1.1'
    It works...
    Regards
    BS

  • ORA-02020: too many database links in use ; but OK with where clause...

    Hello all,
    I have a view called V_MEDGEN_LISTRADIO but I can't run
    SELECT * FROM V_MEDGEN_LISTRADIO
    ORA-02020: too many database links in useThe cause is that we call in the view 5 tables over dblink and the open_links parameter is set to 4.
    What is strange is that when I run this select by adding a where clause then it works!
    SELECT * FROM V_MEDGEN_LISTRADIO WHERE SPRR = 3645;Can someone explain me ? (use of index so all tables are not called ???)
    Thanks

    Explain plan for SELECT * FROM V_MEDGEN_LISTRADIO WHERE SPRR = 3645;
    | Id  | Operation                              | Name            | Rows  | Bytes | Cost (%CPU)| Time     | Pstart| Pstop | Inst   |IN-OUT|
    |   0 | SELECT STATEMENT                       |                 |     1 |   244 |    19   (6)| 00:00:01 |       |       |        |      |
    |   1 |  SORT ORDER BY                         |                 |     1 |   244 |    19   (6)| 00:00:01 |       |       |        |      |
    |   2 |   NESTED LOOPS                         |                 |     1 |   244 |    18   (0)| 00:00:01 |       |       |        |      |
    |   3 |    NESTED LOOPS                        |                 |     1 |   218 |    17   (0)| 00:00:01 |       |       |        |      |
    |   4 |     NESTED LOOPS                       |                 |     1 |   188 |    15   (0)| 00:00:01 |       |       |        |      |
    |   5 |      NESTED LOOPS                      |                 |     3 |   384 |    10   (0)| 00:00:01 |       |       |        |      |
    |   6 |       NESTED LOOPS                     |                 |     3 |   186 |     4   (0)| 00:00:01 |       |       |        |      |
    |   7 |        REMOTE                          | SPRR            |     1 |    20 |     2   (0)| 00:00:01 |       |       | DEV10~ | R->S |
    |   8 |        REMOTE                          | MPAT_MF         |     3 |   126 |     2   (0)| 00:00:01 |       |       | DEV10~ | R->S |
    |   9 |       REMOTE                           | SPER_P          |     1 |    66 |     2   (0)| 00:00:01 |       |       | ORAP_~ | R->S |
    |* 10 |      TABLE ACCESS BY GLOBAL INDEX ROWID| DOSSIER_MEDICAL |     1 |    60 |     3   (0)| 00:00:01 | ROWID | ROWID |        |      |
    |* 11 |       INDEX RANGE SCAN                 | DOSMED_MPR_IDX2 |     2 |       |     1   (0)| 00:00:01 |       |       |        |      |
    |  12 |     REMOTE                             | MEP             |     1 |    30 |     2   (0)| 00:00:01 |       |       | ORAP_~ | R->S |
    |  13 |    REMOTE                              | SSV             |     1 |    26 |     1   (0)| 00:00:01 |       |       | ORAP_~ | R->S |
    Predicate Information (identified by operation id):
      10 - filter("DM"."EXAM_TYPE"='TELEM')
      11 - access("DM"."MPR"="P"."SPER")
    Remote SQL Information (identified by operation id):
       7 - SELECT "SPRR","MNEMO" FROM "SPRR" "MP" WHERE "SPRR"=3645 (accessing 'DEV10_DBLK' )
       8 - SELECT "SPAT","DU","RMPB","SPRR_MF","AU" FROM "MPAT_MF" "MF" WHERE "SPRR_MF"=3645 AND NVL("AU",:1+1)>=:2 AND
           "RMPB"='PRINC' AND "DU"<=:3 (accessing 'DEV10_DBLK' )
       9 - SELECT "SPER","NOM","PRENOM","DTE_NAI" FROM "SPER_P" "P" WHERE "SPER"=:1 (accessing 'ORAP_DBLK' )
      12 - SELECT "MSJ","MEPNO_SEQ","SSV_OU_PAT_SEJOURNE" FROM "MEP" "MEP" WHERE :1="MSJ" AND :2="MEPNO_SEQ" (accessing 'ORAP_DBLK' )
      13 - SELECT "SSV","LIB_1" FROM "SSV" "SSV" WHERE :1="SSV" (accessing 'ORAP_DBLK' )Explain plan for SELECT * FROM V_MEDGEN_LISTRADIO
    Plan hash value: 3820716840
    | Id  | Operation                                | Name                  | Rows  | Bytes | Cost (%CPU)| Time     | Pstart| Pstop | Inst   |IN-OUT|
    |   0 | SELECT STATEMENT                         |                       |     7 |  1708 |   771   (1)| 00:00:10 |       |       |        |      |
    |   1 |  SORT ORDER BY                           |                       |     7 |  1708 |   771   (1)| 00:00:10 |       |       |        |      |
    |   2 |   NESTED LOOPS                           |                       |     7 |  1708 |   770   (1)| 00:00:10 |       |       |        |      |
    |   3 |    NESTED LOOPS                          |                       |     7 |  1568 |   763   (1)| 00:00:10 |       |       |        |      |
    |   4 |     NESTED LOOPS                         |                       |     7 |  1386 |   756   (1)| 00:00:10 |       |       |        |      |
    |   5 |      NESTED LOOPS                        |                       |     7 |  1176 |   742   (1)| 00:00:09 |       |       |        |      |
    |   6 |       NESTED LOOPS                       |                       |   194 | 24444 |   414   (1)| 00:00:05 |       |       |        |      |
    |   7 |        TABLE ACCESS BY GLOBAL INDEX ROWID| DOSSIER_MEDICAL       |   194 | 11640 |    23   (0)| 00:00:01 | ROWID | ROWID |        |      |
    |*  8 |         INDEX RANGE SCAN                 | DOSMED_EXAM_TYPE_IDX2 |   194 |       |     1   (0)| 00:00:01 |       |       |        |      |
    |   9 |        REMOTE                            | SPER_P                |     1 |    66 |     2   (0)| 00:00:01 |       |       | ORAP_~ | R->S |
    |  10 |       REMOTE                             | MPAT_MF               |     1 |    42 |     2   (0)| 00:00:01 |       |       | DEV10~ | R->S |
    |  11 |      REMOTE                              | MEP                   |     1 |    30 |     2   (0)| 00:00:01 |       |       | ORAP_~ | R->S |
    |  12 |     REMOTE                               | SSV                   |     1 |    26 |     1   (0)| 00:00:01 |       |       | ORAP_~ | R->S |
    |  13 |    REMOTE                                | SPRR                  |     1 |    20 |     1   (0)| 00:00:01 |       |       | DEV10~ | R->S |
    Predicate Information (identified by operation id):
       8 - access("DM"."EXAM_TYPE"='TELEM')
    Remote SQL Information (identified by operation id):
       9 - SELECT "SPER","NOM","PRENOM","DTE_NAI" FROM "SPER_P" "P" WHERE :1="SPER" (accessing 'ORAP_DBLK' )
      10 - SELECT "SPAT","DU","RMPB","SPRR_MF","AU" FROM "MPAT_MF" "MF" WHERE NVL("AU",:1+1)>=:2 AND "RMPB"='PRINC' AND "DU"<=:3 AND
            :4="SPAT" (accessing 'DEV10_DBLK' )
      11 - SELECT "MSJ","MEPNO_SEQ","SSV_OU_PAT_SEJOURNE" FROM "MEP" "MEP" WHERE :1="MSJ" AND :2="MEPNO_SEQ" (accessing 'ORAP_DBLK' )
      12 - SELECT "SSV","LIB_1" FROM "SSV" "SSV" WHERE :1="SSV" (accessing 'ORAP_DBLK' )
      13 - SELECT "SPRR","MNEMO" FROM "SPRR" "MP" WHERE :1="SPRR" (accessing 'DEV10_DBLK' )

Maybe you are looking for

  • T code F-28 Upload

    Hello, Folks, Could you please help me?  I just wanted make upload directely from some excel file to t-code f-28. How can I do it? Best Regards, Queiroz

  • Help for design report layout

    Hi all, Could you tell me any tools for design report layout or other way to design? Beside Quick Viewer, SAP Query, Report Painter/Writer, they can't group data and very complex. Thank you!

  • Download error/unable to download song from itunes?

    I bought songs from itunes store but i can not get them downloded. What I have to do? I have this message showing under the title"download error. Tap to try" And anotner message appears: Unable to download song, "name of song" could not be downloaded

  • My security answers are not working

    i am trying to authorize a new computer for my itunes - of course in a hurry and my security answers are not working

  • Can anyone tell me about returns?

    sending broken ipod back on warrenty so apple sent me a box to return it in but gave me no address sticker and it said in the literature that a corrier will come and collect it but they gave no indication of when.... anyone with any ideas as to where