Question : ORA error-too many values


When I debug, I see the problem was with the execute immediate statement.  The table where cursor is selecting the data from is a temporary table available for that session.


PROCEDURE PROGRAMASSIGNMENT_CONV (P_CLIENTID IN NUMBER) IS

    TYPE PROGRAMASSIGNMENT_TAB IS TABLE OF PROGRAMASSIGNMENT%ROWTYPE INDEX BY SIMPLE_INTEGER;
    L_PROGRAMASSIGNMENT   PROGRAMASSIGNMENT_TAB;
   -- L_PROGRAMASSIGNMENTID PROGRAMASSIGNMENT.PROGRAMASSIGNMENTID%TYPE;
    L_LIMIT  PLS_INTEGER := 500000;

    CURSOR CUR_PROGRAMASSIGNMENT IS
      SELECT PROGRAMASSIGNMENTID_SEQ.NEXTVAL,
             A.CLIENTID,
             A.VENDORID,
             A.PID,
             A.SUBPID,
             A.PROGRAMID,
             A.TRIAGEFILTERID,
             A.CASEID,
             A.CLIENTCASENO,
             A.WORKFLOWSTATUS,
             A.APPLICATIONID,
             A.ISPRIMARYIND,
             A.STATUSCHANGEREASONID,
             A.INTERVENTIONLEVELID,
             A.DMINTERVENTIONTYPEID,
             A.PROGRAMRANK,
             A.IDENTIFIEDDATE,
             A.SELECTEDDATE,
             A.OPENEDDATE,
             A.CLOSEDDATE,
             A.DECLINEDDATE,
             A.INTAKEDATE,
             A.INTAKESOURCEID,
             A.REFERRALID,
             A.INSERTEDBY,
             sysdate,
             A.RUNID
        FROM CDRLOAD.GTEMP_BSC_PROGRAMASSIGNMENT A;

   l_clientname      VARCHAR2 (100);

  BEGIN
    -- populate cdrload.gtemp_bsc_programassignment from sql server thru DBLINK

    l_clientname := getclientname (p_clientid, 'CDR_PROGRAMASSIGNMENT_CONV');


    EXECUTE IMMEDIATE 'INSERT INTO cdrload.gtemp_bsc_programassignment SELECT * FROM ' || l_clientname;



    SELECT A.RUNID
      INTO L_RUNID
      FROM CDRLOAD.GTEMP_BSC_PROGRAMASSIGNMENT A
     WHERE ROWNUM = 1;

    OPEN CUR_PROGRAMASSIGNMENT;
    LOOP
      FETCH CUR_PROGRAMASSIGNMENT BULK COLLECT
        INTO L_PROGRAMASSIGNMENT LIMIT L_LIMIT;
      RUNIDTRACKING_PKG.STATUS_TRACKING(P_CLIENTID,
                                        'conversion_pkg.CDR_PROGRAMASSIGNMENT_CONV',
                                        'Bulk collect count for INSERT',
                                        L_PROGRAMASSIGNMENT.COUNT,
                                        L_RUNID);


      -- insert into programassignment table

      FORALL I IN 1 .. L_PROGRAMASSIGNMENT.COUNT
        INSERT INTO PROGRAMASSIGNMENT VALUES L_PROGRAMASSIGNMENT (I);
      EXIT WHEN CUR_PROGRAMASSIGNMENT%NOTFOUND;
    END LOOP;
    CLOSE CUR_PROGRAMASSIGNMENT;
  EXCEPTION
    WHEN OTHERS THEN
      RUNIDTRACKING_PKG.STATUS_TRACKING(P_CLIENTID,
                                        'conversion_pkg.CDR_PROGRAMASSIGNMENT_CONV',
                                        SQLERRM,
                                        0,
                                        L_RUNID);
  END PROGRAMASSIGNMENT_CONV;

Answer : ORA error-too many values

You need to use your column names.

I don't know your table structures.  You need to get the column names from gtemp_bsc_programassignment and CDR_PROGRAMASSIGNMENT_CONV and insert them explicitly into the insert statement:

INSERT INTO cdrload.gtemp_bsc_programassignment(----INSERT YOUR COLUN NAMES HERE-----)
SELECT (----INSERT YOUR COLUN NAMES HERE-----) FROM IngersollRand.CDR_PROGRAMASSIGNMENT_CONV@INGEST;
Random Solutions  
 
programming4us programming4us