Need help on DATA_REMAP procedure.

Hi All,
I am using data pump APIs to perform export and import. But “data_remap” procedure is throwing exceptions.
SQL*Plus: Release 11.1.0.7.0 - Production on Wed Apr 10 04:29:09 2013
Copyright (c) 1982, 2008, Oracle.  All rights reserved.+
Connected to:+
Oracle Database 11g Release 11.1.0.7.0 - 64bit Production+
We have a set of tables, whose data needs to be exported. We have following constraints to perform export:
1) Only the tables that contains a column (lets say test_id) needs to be exported. We are fetching these tables by querying "all_tab_columns" view as {select table_name from all_tab_columns where column_name = 'test_id' and owner = user} This query fetches around 40 tables.
2) From this set of tables we need only the data which satisfy the condition {select * from <tablename> where test_id = 10}.
3) Now we need to replace test_id value 10 with -1.
Create or replace package body TESTPACKAGE as
function SetTestID(p_TestId number) return number is
v_TestId number := -1;
begin
return v_TestId;
end;
procedure exportData is
h1 number; -- Data Pump job handle
begin
h1 := dbms_datapump.open('EXPORT',
'TABLE',
null,
'EXAMPLE1',
'LATEST');
dbms_datapump.add_file(h1,
'example1.dmp',
'EXPORT');
dbms_datapump.metadata_filter(handle => h1,
name => 'NAME_EXPR',
value => 'IN (select TABLE_NAME from ALL_TAB_COLUMNS A where A.COLUMN_NAME = TEST_ID'' and owner = user and not (A.TABLE_NAME like ''PV%'') and not (A.TABLE_NAME like ''IV%'') and not (A.TABLE_NAME like ''IMV%'') and not (A.TABLE_NAME like ''BIN$%''))',
object_type => 'TABLE');
dbms_datapump.data_filter(handle => h1,
name => 'SUBQUERY',
value => 'WHERE TEST_ID = 10',
table_name => null,
schema_name => null);
dbms_datapump.data_remap(handle => h1,
name => 'COLUMN_FUNCTION',
table_name => 'TABLE1',
column => 'TEST_ID',
function => 'TESTPACKAGE.SETTESTID(10)',
schema => 'ATOM606');
dbms_datapump.start_job(h1);
end;
end;
But here data_remap procedure is giving below error
+"ORA-39232: invalid remap function: TESTPACKAGE.SETTESTID(10)"+
Can anyone help how to use this data_remap procedure and how to pass the value to the function parameter? And also how to specify the whole table list?
Any help is highly appreciated.Thanks in advance :)

I think there is some limit on the length of this parameter. It was not accepting the whole string <SchemaName>.<TableName>.Test_Id.
So i tried with
dbms_datapump.data_remap(handle => h1,
name => 'COLUMN_FUNCTION',
table_name => 'TABLE1',
column => 'TABLE1.TEST_ID',
function => 'ATOM606.TESTPACKAGE.SETTESTID',
schema => 'ATOM606');
But it doesn't make any difference, still getting the same error.
I also tried by passing the column name as input argument to the SETTESTID function, hoping for some miracle, but even that doesn't make any difference.

Similar Messages

  • Need help for a procedure

    All,
    I have a function and a procedure in a package. The function is called by the procedure. The function returns multiple records with multiple fields in a table type. The procedure uses those values to update the database. My question is how can I get those values to update database. Need sample of code.
    beloew is my package:
    CREATE OR REPLACE PACKAGE "test_record2" as
    type V_testre is record (
    USER_ID NUMBER,
    B_ID NUMBER,
    A_ID NUMBER);
    Type T_userInfo is table of user_Access %rowtype
    index by binary_integer;
    procedure get_info(userid in number);
    function P_GetProfile(userid in number) return T_userInfo;
    end;/
    CREATE OR REPLACE PACKAGE BODY "test_record2" as
    procedure get_info(userid in number) as
    get_access T_userInfo;
    v_userid number;
    begin
    get_access := P_GetProfile(v_userid);
    --How to get the values from get_access to do the insert.
    --Need help here!!!
    --insert into test_access values get_access
    end;
    -- test table
    function P_GetProfile(userid in number) return T_userInfo is
    profile_info T_userInfo;
    CURSOR c1 IS
              select * from user_Access          
    where USER_ID = userid;
    BEGIN
         OPEN c1;
         FETCH c1 BULK COLLECT INTO profile_info;
         return profile_info;
    END;
    End;
    --create the table
    CREATE TABLE user_access (user_id NUMBER, m_id NUMBER, n_id NUMBER);
    INSERT INTO user_access VALUES (1, 11, 111);
    INSERT INTO user_access VALUES (1, 22, 222);
    INSERT INTO user_access VALUES (1, 33, 333);
    INSERT INTO user_access VALUES (2, 11, 111);
    INSERT INTO user_access VALUES (2, 22, 222);
    INSERT INTO user_access VALUES (2, 33, 333);

    CALL is not valid PL/SQL. (In fact, it's only valid in OLAP).
    You want either...
    BEGIN
        test_record2.get_info(1);
    END;
    /...or (in SQL*Plus)....
    EXEC test_record2.get_info(1)I commend the documentation to you.
    Cheers, APC

  • Need help in creating procedure

    Hi all,
    Can some body please help me in creating a procedure.
    I have a table "NAMES" and the columns as LNAME, FNAME, EMPID
    now I have a sequence EMPID_SEQ.
    I have the data like
    LNAME      FNAME      EMPID
    JOHN        SMITH
    JOHN        SMITH
    PETER      PARKER
    MIKE        JONES
    MIKE        JONES
    MIKE        JONESNow I want to write a procedure in order to give a number(EMPID_SEQ.NEXTVAL) for same first and last names like
    LNAME      FNAME      EMPID
    JOHN        SMITH       1
    JOHN        SMITH       1
    PETER      PARKER       2
    MIKE        JONES        3
    MIKE        JONES        3
    MIKE        JONES        3can anybody please help me in writing this procedure.
    Thanks in advance.

    Better to use SQL
    merge INTO test_tab t USING
      SELECT
        lname,
        fname,
        rownum rn
      FROM
          SELECT DISTINCT
            fname,
            lname
          FROM
            test_tab
    s ON
      t.lname = s.lname AND t.fname = s.fname
    WHEN matched THEN
      UPDATE
      SET
        empid = rn;Possibly that's not what the homework assignment called for, though.

  • Need help for this Procedure

    A Simple procedure for inserting rows in the table
    This is how the Source Table looks like Table Name:BSNL Contains the following Data. Here the Column MDI is Bold and MAI is regular and PRN# is Bold.
    MDI MAI PNR#
    50001112220 5000111220 25000
    50001112221 5000111221 25001
    50001112222 5000111222 25002
    50001112223 5000111223 25003
    50001112224 5000111224 25004
    50001112225 5000111225 25005
    50001112226 5000111229 25006
    Destination table TVS which contains two columns(MDI and PNR#)
    Here i have to write a procedure which inserts row in the destination table TVS according to the following condition
    1) If mdi=mai then insert only one row in the destination table TVS with mdi and pnr# shown below the column MDI is Bold and PNR# is Regular
    MDI PNR#
    50001112220 25000
    2) If MDI <> MAI then insert values like this
    if MDI=50001112226 and MAI=50001112229 and PNR#=25006 then insert it
    like shown below in the destination Table ie PNR# remains same and only the
    MDI values will be inserted in incremented way the columns MDI is Bold and
    PNR# is Regular.
    MDI PNR#
    50001112226 25006
    50001112227 25006
    50001112228 25006
    50001112229 25006
    so any idea please share it with me
    Thanks in Advance.

    You can check the following script - this will work in 9i --
    satyaki>
    satyaki>
    satyaki>select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
    PL/SQL Release 10.2.0.1.0 - Production
    CORE    10.2.0.1.0      Production
    TNS for Linux: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    satyaki>
    satyaki>
    satyaki>create table bsnl
      2    (
      3       MDI     number(15),
      4       MAI     number(15),
      5       PNR     number(5)
      6    );
    Table created.
    satyaki>
    satyaki>
    satyaki>insert into bsnl values(&MDI,&MAI,&PNR);
    Enter value for mdi: 50001112220
    Enter value for mai: 50001112220
    Enter value for pnr: 25000
    old   1: insert into bsnl values(&MDI,&MAI,&PNR)
    new   1: insert into bsnl values(50001112220,50001112220,25000)
    1 row created.
    satyaki>/
    Enter value for mdi: 50001112221
    Enter value for mai: 50001112221
    Enter value for pnr: 25001
    old   1: insert into bsnl values(&MDI,&MAI,&PNR)
    new   1: insert into bsnl values(50001112221,50001112221,25001)
    1 row created.
    satyaki>/
    Enter value for mdi: 50001112222
    Enter value for mai: 50001112222
    Enter value for pnr: 25002
    old   1: insert into bsnl values(&MDI,&MAI,&PNR)
    new   1: insert into bsnl values(50001112222,50001112222,25002)
    1 row created.
    satyaki>/
    Enter value for mdi: 50001112223
    Enter value for mai: 50001112223
    Enter value for pnr: 25003
    old   1: insert into bsnl values(&MDI,&MAI,&PNR)
    new   1: insert into bsnl values(50001112223,50001112223,25003)
    1 row created.
    satyaki>/
    Enter value for mdi: 50001112224
    Enter value for mai: 50001112224
    Enter value for pnr: 25004
    old   1: insert into bsnl values(&MDI,&MAI,&PNR)
    new   1: insert into bsnl values(50001112224,50001112224,25004)
    1 row created.
    satyaki>/
    Enter value for mdi: 50001112225
    Enter value for mai: 50001112225
    Enter value for pnr: 25005
    old   1: insert into bsnl values(&MDI,&MAI,&PNR)
    new   1: insert into bsnl values(50001112225,50001112225,25005)
    1 row created.
    satyaki>/
    Enter value for mdi: 50001112226
    Enter value for mai: 50001112229
    Enter value for pnr: 25006
    old   1: insert into bsnl values(&MDI,&MAI,&PNR)
    new   1: insert into bsnl values(50001112226,50001112229,25006)
    1 row created.
    satyaki>
    satyaki>
    satyaki>commit;
    Commit complete.
    satyaki>
    satyaki>
    satyaki>set lin 10000
    satyaki>
    satyaki>
    satyaki>select * from bsnl;
           MDI        MAI        PNR
    5.0001E+10 5.0001E+10      25000
    5.0001E+10 5.0001E+10      25001
    5.0001E+10 5.0001E+10      25002
    5.0001E+10 5.0001E+10      25003
    5.0001E+10 5.0001E+10      25004
    5.0001E+10 5.0001E+10      25005
    5.0001E+10 5.0001E+10      25006
    7 rows selected.
    satyaki>select to_char(MDI) MDI,
      2            to_char(MAI) MAI,
      3            to_char(PNR)
      4     from bsnl;
    MDI                                      MAI                                      TO_CHAR(PNR)
    50001112220                              50001112220                              25000
    50001112221                              50001112221                              25001
    50001112222                              50001112222                              25002
    50001112223                              50001112223                              25003
    50001112224                              50001112224                              25004
    50001112225                              50001112225                              25005
    50001112226                              50001112229                              25006
    7 rows selected.
    satyaki>
    satyaki>
    satyaki>select * from tvs;
    select * from tvs
    ERROR at line 1:
    ORA-00942: table or view does not exist
    satyaki>create table tvs
      2   (
      3      MDI      number(15),
      4      PNR      number(5)
      5   );
    Table created.
    satyaki>
    satyaki>
    satyaki>select * from tvs;
    no rows selected
    satyaki>
    satyaki>
    satyaki>insert into tvs
      2  select MDI + (level - 1) MDI,PNR
      3  from bsnl
      4  connect by rownum <= decode((MAI - MDI),0,1,(MAI - MDI)+1)
      5  order by MDI;
    10 rows created.
    satyaki>
    satyaki>
    satyaki>select to_char(MDI) MDI,
      2            to_char(PNR) PNR
      3     from tvs;
    MDI                                      PNR
    50001112220                              25000
    50001112221                              25001
    50001112222                              25002
    50001112223                              25003
    50001112224                              25004
    50001112225                              25005
    50001112226                              25006
    50001112227                              25006
    50001112228                              25006
    50001112229                              25006
    10 rows selected.
    satyaki>Regards.
    Satyaki De.
    Oops!
    Needs to modify my script now.

  • Need Help on this procedure

    hello,
    I need some help on what is the proper way or correct way to do this.
    I just taped a wedding for a friend who somewhat trusted me, I edited it, and it came out decent. I then exported the 3/4 finished product to quicktime, this QT file is about 12 gigs, the friend wants the wedding on DVD, how can i do this, I was told to get toaster to make the DVD, I have Toaster 6, but if i remember correctly, it stated it would take about 12 hours to complete. AM I doing something wrong. should I get another product to make DVD that wont take so long?
    I dont think I can afford the DVD studio 3/4 atm,
    Need some guidance please. and Help too 8)
    Shiyonin.
    G5 Dual 1.8 Mac OS X (10.4.5)

    12 Gigs on a quicktime file should come out to just under an hour, which after encoding will fit comfortably on a DVD. iDVD will take care of this. it is part of the iLife suite, which should have come with your computer, but in any case can be purchased from Apple for a reasonable cost. As for time, it will take a long time, but should be well under 12 hours. The time to complete box often starts with a high estimate, and reduces it rapidly, but for this sort of work I usually leave the computer to get on with it overnight.

  • Need help with this procedure!

    Write a function/procedure that will take a year parameter(e.g 2007)
    and will go through all AP Invoices (with invoice_date falling within that year)
    for the Vision Services organization (org_id=458) and output all
    project numbers that are associated with any of these invoices.
    Also output the count of project related invoices and a count of non-project related invoices.
    Here is some basic information abt the data required to build the above proc!
    select project_id,invoice_date
    from ap_invoices_all api
    where api.org_id='458'
    and to_char(invoice_date,'YYYY')='2007';
    select pa.segment1 from pa_projects pa
    segment1 is the project number
    project_id is join between pa_projects and ap_invoices_all
    Can we write the logic for above procedure using index by table? or Do we have to go with cursor with parameters or can it be done either way ...would appreciate ur feedback to build this program

    No need to use two selects.
    Use only one as:
    SELECT ppa.segment1 project_numbers
    FROM pa_projects ppa
    ,ap_invoices_all api
    WHERE api.org_id='458'
    AND invoice_date BETWEEN '01-JAN-2007' AND '31-DEC-2007'
    AND api.project_id = ppa.project_id
    You should look out for the following:
    (1) you are using pa_projects not pa_projects_all and you are using org_id condition for ap_invoices_all
    (3) you can do either way - function/procedure, index by table/cursor. What is your specific concern about picking one method over the other?

  • Need help in procedure

    Hi Experts,
    I have wrote a procedure which is being fired by a trigger and update or insert the Attendance_day table on the basis of punch string, the below issue is coming when employee do two regular shift.
    [code]
    select * from ATTENDANCEMASTER where DATE_PUNCH>='01-aug-2013' and EMP_CD in('E03497');
    SNO
    EMP_CD
    DATE_PUNCH
    TIME_PUNCH
    PREFIX
    INOUT
    8027551423
    E03497   
    1-Aug-13
    8:53
    200
    I
    8027890076
    E03497   
    1-Aug-13
    19:01
    200
    O
    8027980116
    E03497   
    2-Aug-13
    8:56
    200
    I
    8028070441
    E03497   
    2-Aug-13
    17:43
    200
    O
    8028071247
    E03497   
    3-Aug-13
    8:49
    200
    I
    8028160480
    E03497   
    3-Aug-13
    17:43
    200
    O
    8028160680
    E03497   
    3-Aug-13
    22:51
    200
    I
    8028161035
    E03497   
    4-Aug-13
    6:54
    200
    O
    8028661326
    E03497   
    6-Aug-13
    8:51
    200
    I
    8028840273
    E03497   
    6-Aug-13
    18:55
    200
    O
    8028841247
    E03497   
    7-Aug-13
    8:56
    200
    I
    This table is being updated after employees swipe the card. If u look @ the record of 3rd aug the employee has done two shift 1st in 1st shift(9-6pm) and another on 3rd shift (11pm-to next day of 7am). After this table the main attendnace_day table is being updated
    SELECT * FROM ATTENDANCE_DAY WHERE EMP_CODE IN('E03497') AND ATTD_DATE >='01/AUG/2013';
    attd_date
    emp_code
    in_time
    out_time
    status
    shift
    day_no
    chg_date
    chg_user
    chg_term
    result
    punch_str
    1-Aug-13
    E03497   
    8:53
    19:01
    (null)
    G0013
    5
    1-Aug-13
    STAR     
    PAPNABMS      
    -08:53 , -19:01
    2-Aug-13
    E03497   
    8:56
    17:43
    (null)
    G0013
    6
    2-Aug-13
    STAR     
    PAPNABMS      
    -08:56 , -17:43
    3-Aug-13
    E03497   
    8:49
    17:43
    (null)
    G0013
    7
    4-Aug-13
    PRITESH  
    21PAPNADIXIT  
    -08:49 , -17:43 , -22:51,*-17:43
    6-Aug-13
    E03497   
    8:51
    18:55
    (null)
    G0013
    3
    6-Aug-13
    STAR     
    PAPNABMS      
    -08:51 , -18:55
    7-Aug-13
    E03497   
    8:56
    G0013
    4
    7-Aug-13
    STAR     
    PAPNABMS      
    0
    The out time in aug 3rd record is 17:43 but as employee has done two shifts the out time must be:
    8028161035
    E03497   
    4-Aug-13
    6:54
    200
    O
    That's why I need to change the procedure in way that it should update the attendance_day table on the basis of IN OUT flag and must capture these types of records properly.
    The Procedure is mentioned below:
    [code]
    CREATE OR REPLACE
    PROCEDURE UPDATE_ATTENDANCE
        AS_EMP_CODE   CHAR,
        AS_DATE_PUNCH DATE,
        AS_TIME_PUNCH CHAR
    AS
    BEGIN
      DECLARE
        a_time_punch workshft.in_time%type := AS_TIME_PUNCH;
        a_work_shift employee.work_shift%type;
        a_shift_intime workshft.in_time%type;
        a_lunch_time workshft.lunch_time%type;
        a_hol_tblno holiday.hol_tblno%type;
        a_fin_entity site.fin_entity%type;
        a_prv_date DATE := AS_DATE_PUNCH - 1;
        a_count    NUMBER(5);
        a_count1   NUMBER(5);
        CURSOR c1
        IS
          SELECT work_shift
          FROM
            (SELECT tran_date eff_date,
              work_shift_o work_shift,
              conf_date,
              chg_date
            FROM employee_det_change
            WHERE emp_code = AS_EMP_CODE
            AND tran_date  > AS_DATE_PUNCH
            AND status     = 'C'
          UNION ALL
          SELECT eff_Date,
            work_shift__fr work_shift,
            conf_date,
            chg_date
          FROM emp_employ_events
          WHERE emp_code = AS_EMP_CODE
          AND eff_date   > AS_DATE_PUNCH
          AND confirmed  = 'Y'
          ORDER BY eff_date,
            conf_date,
            chg_date;
        BEGIN
          SELECT b.fin_entity
          INTO a_fin_entity
          FROM employee a,
            site b
          WHERE a.emp_code = AS_EMP_CODE
          AND b.site_code  = a.work_site;
          SELECT COUNT(*)
          INTO a_count
          FROM work_shift
          WHERE emp_code = AS_EMP_CODE
          AND AS_DATE_PUNCH BETWEEN from_dt AND to_dt;
          IF (a_count > 0) THEN
            SELECT shift
            INTO a_work_shift
            FROM work_shift
            WHERE emp_code = AS_EMP_CODE
            AND AS_DATE_PUNCH BETWEEN from_dt AND to_dt;
          ELSE
            FOR i IN c1
            LOOP
              a_work_shift := i.work_shift;
              EXIT;
            END LOOP;
            IF (a_work_shift IS NULL) THEN
              SELECT work_shift
              INTO a_work_shift
              FROM employee
              WHERE emp_code = AS_EMP_CODE;
            END IF;
          END IF;
          SELECT in_time,
            lunch_time
          INTO a_shift_intime,
            a_lunch_time
          FROM workshft
          WHERE shift = a_work_shift
          AND day_no  = TO_CHAR(AS_DATE_PUNCH,'D');
          SELECT COUNT(*)
          INTO a_count
          FROM attendance_day
          WHERE attd_date = AS_DATE_PUNCH
          AND emp_code    = AS_EMP_CODE;
          IF (a_count     > 0) THEN
            IF (A_FIN_ENTITY IN ('IC','HU')) THEN
              ------UPDATE HERE-----
              UPDATE attendance_day
              SET out_time = a_time_punch,
                punch_str  = punch_str || ' , -' || AS_TIME_PUNCH,
                work_hour     = (ddf_time_in_mm(a_time_punch)-ddf_time_in_mm(in_time))
              WHERE attd_date = AS_DATE_PUNCH
              AND emp_code    = AS_EMP_CODE;
            ELSE
              IF (ddf_time_in_mm(a_time_punch) < (ddf_time_in_mm(a_shift_intime) + 30)) THEN
                UPDATE attendance_day
                SET PUNCH_STR = PUNCH_STR || ' , -' || AS_TIME_PUNCH
                WHERE attd_date = AS_DATE_PUNCH
                AND emp_code    = AS_EMP_CODE;
              ELSE
                ------UPDATE HERE-----
                UPDATE attendance_day
                SET out_time = a_time_punch,
                  punch_str  = punch_str || ' , -' || AS_TIME_PUNCH,
                  work_hour     = (ddf_time_in_mm(a_time_punch)-ddf_time_in_mm(in_time))
                WHERE attd_date = AS_DATE_PUNCH
                AND emp_code    = AS_EMP_CODE;
              END IF;
            END IF;
          ELSE
            SELECT COUNT(*)
            INTO a_count1
            FROM work_shift
            WHERE emp_code = AS_EMP_CODE
            AND a_prv_date BETWEEN from_dt AND to_dt
            AND shift =
              (SELECT shift
              FROM workshft
              WHERE shift   = work_shift.shift
              AND day_no    = TO_CHAR(a_prv_date,'D')
              AND (out_time > '24:00'
              OR out_time   < in_time)
            SELECT ddf_get_holtblno(AS_EMP_CODE,AS_DATE_PUNCH) INTO a_hol_tblno FROM dual;
            SELECT COUNT(*)
            INTO a_count
            FROM holiday
            WHERE hol_tblno = a_hol_tblno
            AND hol_date = AS_DATE_PUNCH;
            IF ((A_COUNT1 > 0) OR (DDF_TIME_IN_MM(A_TIME_PUNCH) < (DDF_TIME_IN_MM(A_SHIFT_INTIME) - 120)) OR (A_COUNT > 0)) THEN
              IF (a_fin_entity IN ('IC','HU') AND a_count1 > 0) THEN
                SELECT COUNT(*)
                INTO a_count
                FROM attendance_day a,
                  workshft b
                WHERE a.attd_date = a_prv_date
                AND a.emp_code = AS_EMP_CODE
                AND b.shift = a.shift
                AND b.day_no = a.day_no
                AND (ddf_time_in_mm(a_time_punch)+1440) <= (ddf_time_in_mm(b.out_time) + (
                  CASE
                    WHEN b.out_time < b.in_time
                    THEN 1440
                    ELSE 0
                  END) + 300);
              ELSE
                SELECT COUNT(*)
                INTO a_count
                FROM attendance_day
                WHERE attd_date = a_prv_date
                AND emp_code    = AS_EMP_CODE
                AND out_time   IS NULL;
              END IF;
              IF (a_count     > 0) THEN
                A_TIME_PUNCH := TO_CHAR((TO_NUMBER(SUBSTR(A_TIME_PUNCH,1,2))+24)) || ':' || SUBSTR(A_TIME_PUNCH,4,2);
                ------UPDATE HERE-----
                UPDATE attendance_day
                SET out_time = a_time_punch,
                  punch_str  = punch_str
                  || ' , -'
                  || a_time_punch,
                  work_hour     = (ddf_time_in_mm(a_time_punch)-ddf_time_in_mm(in_time))
                WHERE attd_date = a_prv_date
                AND emp_code    = AS_EMP_CODE;
              ELSE
                ------UPDATE HERE-----
                INSERT
                INTO attendance_day
                    attd_date,
                    emp_code,
                    in_time,
                    shift,
                    day_no,
                    chg_date,
                    chg_user,
                    chg_term,
                    punch_str,
                    lunch_time
                  VALUES
                    AS_DATE_PUNCH,
                    AS_EMP_CODE,
                    a_time_punch,
                    a_work_shift,
                    TO_CHAR(AS_DATE_PUNCH,'D'),
                    sysdate,
                    USER,
                    userenv('terminal'),
                    || AS_TIME_PUNCH,
                    a_lunch_time
              END IF;
            ELSE
              INSERT
              INTO attendance_day
                  attd_date,
                  emp_code,
                  in_time,
                  shift,
                  day_no,
                  chg_date,
                  chg_user,
                  chg_term,
                  punch_str,
                  lunch_time
                VALUES
                  AS_DATE_PUNCH,
                  AS_EMP_CODE,
                  a_time_punch,
                  a_work_shift,
                  TO_CHAR(AS_DATE_PUNCH,'D'),
                  sysdate,
                  USER,
                  userenv('terminal'),
                  '-' || AS_TIME_PUNCH,
                  a_lunch_time
            END IF;
          END IF;
        END;
      END;
    [code]
    Thnx in advance, help will be appreciated..

    Sorry, totally lost in procedural logic (maybe others could see some ways of improvement)
    PROCEDURE UPDATE_ATTENDANCE
        AS_EMP_CODE   CHAR,
        AS_DATE_PUNCH DATE,
        AS_TIME_PUNCH CHAR
    AS
    BEGIN
    DECLARE
        a_time_punch workshft.in_time%TYPE := AS_TIME_PUNCH;
        a_work_shift employee.work_shift%TYPE;
        a_shift_intime workshft.in_time%TYPE;
        a_lunch_time workshft.lunch_time%TYPE;
        a_hol_tblno holiday.hol_tblno%TYPE;
        a_fin_entity site.fin_entity%TYPE;
        a_prv_date DATE := AS_DATE_PUNCH - 1;
        a_count    NUMBER(5);
        a_count1   NUMBER(5);
    -------------------------------changes 13082013 starts-------------------
        a_count11 workshft.in_time%TYPE;
        a_count22 workshft.in_time%TYPE;
    -------------------------------changes 13082013 ends-------------------
    CURSOR c1 IS
          SELECT work_shift
            FROM(SELECT tran_date eff_date,work_shift_o work_shift,conf_date,chg_date
                   FROM employee_det_change
                  WHERE emp_code = AS_EMP_CODE
                    AND tran_date > AS_DATE_PUNCH
                    AND status = 'C'
                 UNION ALL
                 SELECT eff_date,work_shift__fr work_shift,conf_date,chg_date
                   FROM emp_employ_events
                  WHERE emp_code = AS_EMP_CODE
                    AND eff_date > AS_DATE_PUNCH
                    AND confirmed = 'Y'
           ORDER BY eff_date,conf_date,chg_date;
    BEGIN
          SELECT b.fin_entity
            INTO a_fin_entity
            FROM employee a,
                 site b
           WHERE a.emp_code = AS_EMP_CODE
             AND b.site_code = a.work_site;
          SELECT COUNT(*)
            INTO a_count
            FROM work_shift
           WHERE emp_code = AS_EMP_CODE
             AND AS_DATE_PUNCH BETWEEN from_dt AND to_dt;
          IF (a_count > 0) THEN
              SELECT shift
                INTO a_work_shift
                FROM work_shift
               WHERE emp_code = AS_EMP_CODE
                 AND AS_DATE_PUNCH BETWEEN from_dt AND to_dt;
          ELSE
              FOR i IN c1
              LOOP
                a_work_shift := i.work_shift;
                EXIT;
              END LOOP;
              IF (a_work_shift IS NULL) THEN
                SELECT work_shift
                  INTO a_work_shift
                  FROM employee
                 WHERE emp_code = as_emp_code;
              END IF;
          END IF;
          SELECT in_time,lunch_time
            INTO a_shift_intime,a_lunch_time
            FROM workshft
           WHERE shift = a_work_shift
             AND day_no = TO_CHAR(AS_DATE_PUNCH,'D');
          SELECT COUNT(*)
            INTO a_count
            FROM attendance_day
           WHERE attd_date = AS_DATE_PUNCH
             AND emp_code = AS_EMP_CODE;
          IF (a_count > 0) THEN
            IF (a_fin_entity IN ('IC','HU')) THEN
              UPDATE attendance_day
                 SET out_time = a_time_punch,
                     punch_str = punch_str || ' , -' || as_time_punch,
                     work_hour = (ddf_time_in_mm(a_time_punch) - ddf_time_in_mm(in_time))
               WHERE attd_date = AS_DATE_PUNCH
                 AND emp_code = AS_EMP_CODE;
            ELSE
              IF (ddf_time_in_mm(a_time_punch) < (ddf_time_in_mm(a_shift_intime) + 30)) THEN
                UPDATE attendance_day
                   SET punch_str = punch_str || ' , -' || as_time_punch
                 WHERE attd_date = AS_DATE_PUNCH
                   AND emp_code = AS_EMP_CODE;
              ELSE
                UPDATE attendance_day
                   SET out_time = a_time_punch,
                       punch_str = punch_str || ' , -' || as_time_punch,
                       work_hour = (ddf_time_in_mm(a_time_punch) - ddf_time_in_mm(in_time))
                 WHERE attd_date = AS_DATE_PUNCH
                   AND emp_code = AS_EMP_CODE;
              END IF;
            END IF;
          ELSE
            SELECT COUNT(*)
              INTO a_count1
              FROM work_shift
             WHERE emp_code = AS_EMP_CODE
               AND a_prv_date BETWEEN from_dt AND to_dt
               AND shift = (SELECT shift
                              FROM workshft
                             WHERE shift = work_shift.shift
                               AND day_no = TO_CHAR(a_prv_date,'D')
                               AND (out_time > '24:00' OR out_time < in_time)
            SELECT ddf_get_holtblno(as_emp_code,as_date_punch)
              INTO a_hol_tblno
              FROM dual;
            SELECT COUNT(*)
              INTO a_count
              FROM holiday
             WHERE hol_tblno = a_hol_tblno
               AND hol_date = AS_DATE_PUNCH;
            IF ((a_count1> 0) OR (ddf_time_in_mm(a_time_punch) < (ddf_time_in_mm(a_shift_intime) - 120)) OR (a_count > 0)) THEN
              IF (a_fin_entity IN ('IC','HU') AND a_count1 > 0) THEN
                SELECT COUNT(*)
                  INTO a_count
                  FROM attendance_day a,
                       workshft b
                 WHERE a.attd_date = a_prv_date
                   AND a.emp_code= AS_EMP_CODE
                   AND b.shift = a.shift
                   AND b.day_no= a.day_no
                   AND ddf_time_in_mm(a_time_punch)+1440 <= ddf_time_in_mm(b.out_time) + CASE WHEN b.out_time < b.in_time THEN 1440 ELSE 0 END + 300;
              ELSE
                SELECT COUNT(*)
                  INTO a_count
                  FROM attendance_day
                 WHERE attd_date = a_prv_date
                   AND emp_code = AS_EMP_CODE
                   AND out_time IS NULL;
              END IF;
    -------------------------------changes 13082013 starts-------------------
              SELECT MAX(TIME_PUNCH)
                INTO A_COUNT11
                FROM ATTENDANCEMASTER
               WHERE DATE_PUNCH = A_PRV_DATE
                 AND EMP_CD = AS_EMP_CODE
                 AND INOUT='I';
              SELECT OUT_TIME
                INTO A_COUNT22
                FROM ATTENDANCE_DAY
               WHERE EMP_CODE = AS_EMP_CODE
                 AND ATTD_DATE = a_prv_date;
              DBMS_OUTPUT.PUT_LINE('value of In TIme : ' ||TO_CHAR(A_COUNT22)|| ' , Out Time : '|| TO_CHAR(A_COUNT11));
              IF (A_COUNT11 > A_COUNT22) THEN
                a_count:=1;
              ELSE
                a_count:=0;
              END IF;
    -------------------------------changes 13082013 ends-------------------
              IF (a_count > 0) THEN
                A_TIME_PUNCH := TO_CHAR((TO_NUMBER(SUBSTR(A_TIME_PUNCH,1,2))+24)) || ':' || SUBSTR(A_TIME_PUNCH,4,2);
                UPDATE attendance_day
                   SET out_time = a_time_punch,
                       punch_str = punch_str || ' , -' || a_time_punch,
                       work_hour = (ddf_time_in_mm(a_time_punch) - ddf_time_in_mm(in_time))
                 WHERE attd_date = a_prv_date
                   AND emp_code = AS_EMP_CODE;
              ELSE
                INSERT INTO attendance_day(attd_date,emp_code,in_time,shift,day_no,chg_date,chg_user,chg_term,punch_str,lunch_time)
                VALUES (AS_DATE_PUNCH,AS_EMP_CODE,a_time_punch,a_work_shift,TO_CHAR(AS_DATE_PUNCH,'D'),SYSDATE,USER,USERENV('terminal'),'-'|| AS_TIME_PUNCH,a_lunch_time);
                END IF;
            ELSE
              INSERT INTO attendance_day(attd_date,emp_code,in_time,shift,day_no,chg_date,chg_user,chg_term,punch_str,lunch_time)
              VALUES (AS_DATE_PUNCH,AS_EMP_CODE,a_time_punch,a_work_shift,TO_CHAR(AS_DATE_PUNCH,'D'),SYSDATE,USER,USERENV('terminal'),'-'|| AS_TIME_PUNCH,a_lunch_time);
            END IF;
          END IF;
    END;
    You might be better off just storing the punch data into attendancemaster table (allowing browsing, changes, confirmations, ...) and using sql to update attendance_day table in one shot just before the table is needed for further processing
    Regards
    Etbin

  • Help needed In testing a procedure

    Hi,
    This Is My procedure. I need to test this procedure. How can i pass multiple values to this first two parameters and check ?
    CREATE OR REPLACE PROCEDURE testts (
    i_custid IN str_varray,
    i_pymtref IN str_varray,
    i_screen IN VARCHAR2,
    i_rejreason IN VARCHAR2,
    i_userid IN tl_pymt_details.user_id%TYPE,
    i_country_code IN tl_pymt_details.country_code%TYPE,
    i_city_code IN tl_pymt_details.city_code%TYPE,
    o_intrc OUT NUMBER
    IS
    w_intrc NUMBER;
    w_excep EXCEPTION;
    w_time_zone_date TIMESTAMP ( 6 );
    w_custid tl_pymt_details.cust_id%TYPE;
    w_pymtref tl_pymt_details.pymt_ref%TYPE;
    BEGIN
    IF i_screen = 'confirm'
    THEN
    FOR i IN 1 .. i_custid.COUNT
    LOOP
    w_custid := i_custid (i);
    w_pymtref := i_pymtref (i);
    sp_031_process_time_zone_diff (w_time_zone_date);
    UPDATE tl_pymt_details
    SET status_code = 151
    WHERE cust_id = i_custid (i) AND pymt_ref = i_pymtref (i);
    INSERT INTO tl_pymt_details_trk
    (cust_id, pymt_ref, modi_date, status_code,
    payee_charge_status, modi_by, country_code, city_code)
    (SELECT cust_id, pymt_ref, w_time_zone_date, status_code,
    payee_charge_status, i_userid, pd.country_code,
    pd.city_code
    FROM tl_pymt_details pd, tl_sys_parm sp
    WHERE cust_id = i_custid (i)
    AND pymt_ref = i_pymtref (i)
    AND pd.country_code = i_country_code
    AND pd.city_code = i_city_code);
    END LOOP;
    ELSE
    FOR i IN 1 .. i_custid.COUNT
    LOOP
    w_custid := i_custid (i);
    w_pymtref := i_pymtref (i);
    sp_031_process_time_zone_diff (w_time_zone_date);
    UPDATE tl_pymt_details
    SET status_code = 5,
    rejected_reason = i_rejreason
    WHERE cust_id = i_custid (i) AND pymt_ref = i_pymtref (i);
    INSERT INTO tl_pymt_details_trk
    (cust_id, pymt_ref, modi_date, status_code,
    payee_charge_status, modi_by, country_code, city_code)
    (SELECT cust_id, pymt_ref, w_time_zone_date, status_code,
    payee_charge_status, i_userid, pd.country_code,
    pd.city_code
    FROM tl_pymt_details pd, tl_sys_parm sp
    WHERE cust_id = i_custid (i)
    AND pymt_ref = i_pymtref (i)
    AND pd.country_code = i_country_code
    AND pd.city_code = i_city_code);
    END LOOP;
    END IF;
    o_intrc := 1;
    END testts;
    Your Help is highly appreciated.
    Regards,
    SImma....

    Hi,
    I supposed your varray is created by TYPE str_varray IS VARRAY(100) OF VARCHAR2(30); Then you can do the following:
    declare
      l_custid str_varray;
      l_pymtref str_varray;
      l_out number;
    begin
      /* filling of varray */
      l_custid := str_varray('test1','test2');
      l_pymtref := str_varray('test4','test5');
      /* call procedure */
       testts (
           i_custid => l_custid,
           i_pymtref => l_pymtref,
           i_screen =>   ..... , -- set value
           i_rejreason =>   ..... , -- set value
           i_userid =>   ..... , -- set value
           i_country_code =>   ..... , -- set value
           i_city_code =>   ..... , -- set value
           o_intrc => l_out
    end;Herald ten Dam
    http://htendam.wordpress.com

  • I need help. every time i turn on my laptop an error message pops up: the procedure entry point sqlite_wao -checkpoint could not be located in the dynamic link library SQLite3.dlll  HOW DO I FIX THIS?

    i need help. every time i turn on my laptop an error message pops up: the procedure entry point sqlite_wao -checkpoint could not be located in the dynamic link library SQLite3.dlll  HOW DO I FIX THIS?

    Hi whatsthe77,
    Welcome to Apple Support Communities.
    You may want to follow the steps in this article to reinstall iTunes:
    Removing and reinstalling iTunes, QuickTime, and other software components for Windows Vista or Windows 7
    http://support.apple.com/kb/HT1923
    Have a great day,
    Jeremy

  • Stored DB Procedure - Need help

    Hi. I have a stored database package containing 2 functions. I need help with the function named ret_columns.
    If you look at the code below you will see this function has two different FOR loops. The Select statement in FOR loop that is commented out works just fine, but when I try to use the uncommented select statement in it's place the Function returns NULL (or no records). However, if I run the Select statement in plain old SQL Plus it returns the rows I need. I don't get it.
    Can anyone help me? I'm really stuck on this one.
    -- PACKAGE BODY
    CREATE OR REPLACE package body audit_table_info
    as
    function ret_tables return table_type is
    t_t table_type;
    i integer;
    begin
    i := 1;
    for rec in (select distinct table_name
    from all_triggers
                   where substr(trigger_name,1,9) = upper('tr_audit#')) loop
    t_t(i).tableA := rec.table_name;
    i := i+1;
    end loop;
    return t_t;
    end;
    function ret_columns return column_type is
    c_t column_type;
    i integer;
    begin
    i := 1;
    -- for rec in (select distinct table_name column_name
    -- from all_triggers
    --               where substr(trigger_name,1,9) = upper('tr_audit#')) loop
    for rec in (select distinct b.column_name column_name
    from all_triggers a, all_tab_columns b
                   where a.table_owner = b.owner
                        and a.table_name = b.table_name
                             and substr(a.trigger_name,1,9) = upper('tr_audit#') and rownum < 5) loop                    
    c_t(i).tableB := rec.column_name;
    i := i+1;
    end loop;
    return c_t;
    end;
    end audit_table_info;
    -- PACKAGE DEFINITION
    CREATE OR REPLACE package Audit_Table_Info as
    type table_rec is record( tableA all_tab_columns.TABLE_NAME%type);
    type table_type is table of table_rec index by binary_integer;
    function ret_tables return table_type;
    type column_rec is record( tableB all_tables.TABLE_NAME%type);
    type column_type is table of column_rec index by binary_integer;
    function ret_columns return column_type;
    end Audit_Table_Info;
    /

    It works when I do this!!! I'm so confused.
    Ok...so I did this:
    1 create table test_columns as
    2 (select b.column_name
    3 from all_triggers a,
    4 all_tab_columns b
    5 where a.table_owner = b.owner
    6 and a.table_name = b.table_name
    7 and substr(a.trigger_name,1,9) = upper('tr_audit#')
    8* and rownum < 5)
    SQL> /
    Table created.
    Then altered the Function so the Select statement refers to this table:
    function ret_columns return column_type is
    c_t column_type;
    i integer;
    begin
    i := 1;
    for rec in (select distinct column_name
    from test_columns) loop
    c_t(i).tableB := rec.column_name;
    i := i+1;
    end loop;
    return c_t;
    end;
    Again, any help would be greatly greatly appreciated!

  • Have macbook pro with OS X yosemite 10.10.1 that i need step by step procedures to clean so I can give it to someone else, need help

    have macbook pro with OS X yosemite 10.10.1 that i need step by step procedures to clean so I can give it to someone else, need help

    Before you sell or give away your computer, in addition to the steps listed in this support article, take these steps:
    1. Run Apple Diagnostics or the Apple Hardware Test. The buyer will do this (or he should), and you don't want to be surprised by the results.
    2. Reset the PRAM and the SMC, which might contain personal information.
    3. If you set a firmware password, remove it by running Firmware Password Utility in Recovery mode.
    4. If you activated FileVault in OS X 10.7 or later, turn it off.
    5. If you use Boot Camp, the partition must be deleted.
    6. If you created any other data partitions on the internal drive, remove them in Disk Utility.
    7. If the machine has an internal hard drive, erase the one remaining data partition with the option to zero out data. An SSD doesn't need to be zeroed.
    You can't legally or practically transfer any software downloaded from the Mac App Store to the new owner of the machine, even if it was free. That includes OS X, so if you upgraded to OS X 10.7 or later, you must reinstall an older OS, either from the installation media, if applicable, or by starting up in Internet Recovery mode (option-command-R at the startup chime.) If you installed from physical media, deliver those to the new owner.
    If you're selling the machine, or donating it in working order, and it originally shipped with OS X 10.4 or 10.5, then you have the option of installing either from the discs that came with it or from a retail Snow Leopard disc (which you must then transfer to the buyer.) The buyer should understand that if he doesn't get the original discs from you, he won't get the bundled iLife applications or the Apple Hardware Test. Replacements for the original discs can be ordered from Apple.
    The new owner will have to redownload any software that came from the App Store, including OS X upgrades, under his or her Apple ID. If you ever updated the bundled iLife applications (Garage Band, iMovie, and iPhoto) through the App Store, you can't transfer those either. The buyer will have to purchase them.
    Remove the machine from your list of registered products. If it's still covered by an AppleCare Protection Plan, transfer the coverage to the new owner by following the instructions in the AppleCare Terms and Conditions (under the heading "Transfer of Plan.")

  • Weird error message need help..

    SO.. i havent updated my itunes in a while because i keep getting this weird message.. it comes up when im almost done installing the newest/newer versions of itunes. it says
    "the feature you are trying to use is on a network resource that is unavailable" "click ok to try again or enter an alternate path to a folder containing the installation package 'iTunes.msi' in the box below"
    now when ever i choose a file from the browse box it replies with this message "the file 'xxx' is not a valid installation package for the product iTunes. try to find the installation package iTunes.msi in a folder from which you can install iTunes."
    no idea need help thanks
    ~~~lake
    Message was edited by: DarkxFlamexCaster
    Message was edited by: DarkxFlamexCaster

    +it comes up when im almost done installing the newest/newer versions of itunes. it says+ +"the feature you are trying to use is on a network resource that is unavailable" "click ok to try again or enter an alternate path to a folder containing the installation package 'iTunes.msi' in the box below"+
    With that one, let's try the following procedure.
    First, head into your Add/Remove programs and uninstall your QuickTime. If it goes, good. If it doesn't, we'll just attend to it when we attend to iTunes.
    Next, download and install the Windows Installer CleanUp utility:
    Description of the Windows Installer CleanUp Utility
    Now launch Windows Installer CleanUp ("Start > All Programs > Windows Install Clean Up"), find any iTunes and/or QuickTime entries in the list of programs in CleanUp, select those entries, and click “remove”.
    Next, we'll manually remove any leftover iTunes or QuickTime program files:
    (1) Open Local Disk (C:) in Computer or whichever disk programs are installed on.
    (2) Open the Program Files folder.
    (3) Right-click the iTunes folder and select Delete and choose Yes when asked to confirm the deletion.
    (4) Right-click the QuickTime folder and select Delete and choose Yes when asked to confirm the deletion. (Note: This folder may have already been deleted if QuickTime was successfully removed using Add/Remove Programs earlier.)
    (5) Delete the QuickTime and QuicktimeVR files located in the C:\Windows\system32\ folder. Click Continue if Windows needs confirmation or permission to continue. (Note: These files may have already been deleted if QuickTime was successfully removed using Add/Remove Programs earlier.)
    (6) Right-click on the Recycle Bin and on the shortcut menu, click Empty Recycle Bin.
    (7) Restart your computer.
    Now try another iTunes install. Does it go through properly now?

  • Need Help to create new screen for RF Sapconsole

    Hi Guru's
    I'm new on RF (but some years in ABAP) since last week.
    I need help to create new screens for RF (SAPLLMOB).
    Can someone explain me the procedure to create screen (with ABAP code after) or perhaps someone have an exemple (simple or not) ?
    I have to develop 2 new screens with really few time.
    And, another subsidiary question :
    how SAP can transfert information between the flash gun and the screen i have developped.
    Is there some code to add to enable this functionality or it is include in SAPLLMOB on standard fields ????
    It's a new strange world for me today...
    Many thanks to everyone who can explain me
    Alain

    hi,
    I am facing this problem as well. Is there any reference to create the new screen?
    Hope someone can help! Thanks!
    Regards,
    Darren

  • Need help in Multi language XML Publisher report

    Hi Experts,
    I am working in EBS R12, database 10g.
    I am have a requirement to develop the multilanuge XML Publisher report.
    Details i have till now:
    query in report builder: select * from emp;
    RTF: created RTF(test_rtf)
    Datadefinition: test_dd
    Template:test_t (Language:English, terittory:US, uploaded the RTF)
    Requirement: I need the output in English and German Language.
    For French language, how to proceed further.... Could somebody help me with procedure to get it.
    Do i need to create any RTF and Template for FRENCH language.
    Kindly help me with procedure to be followed.
    Thanks in advance.

    Hi Experts,
    I have below procedure to achieve this but still not able to print output in desired language.
    1. created rtf
    2. created data definition (dd)
    3. created template (tt) [language-english, terittory-US, translatable].
    4. Exported the translated file(.xlf file) to local system
    5. In .xlf file, changed the target language to 'fr-FR' (I want to print in french)
    6. It was successfull done and status is complete
    Through SRS window, i submitted the program...but it's still showing output in english only not in french.
    Note:At SRS window, it's showing only ENGLISH LANGUAGE.
    Am i missing anything....How to show desired languages at SRS WINDOW.
    Could somebody help me how to print data in FRENCH language.
    I hope that i can get the solution from this forum.
    Thanks in advance.

  • Need help in FM used in IDOC

    Hi experts,
    Need help with IDOC. I'm creating 2 FM to process an existing idoc.
    first FM will use the data from idoc 1 to populate EDIDD for idoc 2.
    second FM will use the data from idoc 2 to populate EDIDD for idoc 3.
    when during processing, I encountered error message "No function module for input process code <second FM>".
    although i already link the FM to be used, why does FM 1 cannot call FM 2 directly?
    Thanks.

    In LSMW object attributes... give like this..
    Message Type         CREMAS                      Vendor master data distri
    Basic Type           CREMAS04                    Vendor master data distri
    Enhancement
    after that continue normal LSMW procedure.

Maybe you are looking for

  • Adobe Media Encoder will not lauch for export in Premiere Pro CS4

    Firstly, I can launch Adobe Media Encoder from Windows Explorer. So, stand-alone it works The problem is that is will not lauch if I click on a sequence and select Export Media.  No AME splash ever lauches, after  a few minutes I wait but have to cli

  • Syncing pictures question

    Since I switched to the iPhone 4, when I do a sync, it does not sync pictures from my camera roll to my PC. It syncs every other folder that I have in "Pictures", but it does not sync Camera Roll to my PC. This may be obvious but not to me. What am I

  • Using the new 3tb Western Digital drives in a 2 gen drobo

    I am confused as to whether I can use a WD 3tb drive in my drobo. MY setup is as follows: intel 27 inch imac running snow leopard, i tunes 10, 2nd gen drobo with the latest firmware installed. I have my itunes library on the drobo and I stream all of

  • How to close a Fork

    Hi, I have designed a BPM in such a way that the 3 idocs are received by the FORK with matnr as corelation. The design requires that if atleast 1 idoc comes, the Fork will have to close after a waiting period of 1 minute. To achieve this 1 added a de

  • No words in drop down boxes

    When I pass the mouse over a word or website in the tool bars etc: I get a drop down box but no words.