OCI-22303 in by OCITypeByName

Hi,
I am getting an error OCI-22303 when trying to use OCITypeByName method.
Basically I am trying to use publish-subscribe notification mode to get get notification whenever a new message comes in the queue.
I am able to register my callback function with the oracle queue and whenever a new message is coming to the queue its my callback function is being invoked by oracle
but the problem is ,in that callback function when I am trying to dequeue the message it gives error on OCITypeByName method(ie OCI-22303).
Same code inside callback function is working fine when I am directly calling the callback function ie(not invoked by oracle).
Could you help me out what is the reason behind it?
Oracle version :8.1.6
In queue table payload is object type.
I have tried this with oracle8.1.7's catexp.sql also but it dint work
Please help me out
rajeev

Hi Rajiv,
Could you please provide more details?
Specifically, I would like to see how your
callback looks.
And you mentioned that if you directly called
the callback function, then OCITypeByName
worked. I am assuming you called this callback in some OCI program. So, I would also like to see the OCI program.
And one other thing. Did you make sure you had the same user session in both the cases?
thx,
Ravi

Similar Messages

  • OCI-22303: type ""."DISCREPTABTYP"

    OCI-22303: type ""."DISCREPTABTYP" not found:BEGIN
    timeKeeper_package.discrepancy2(:unit, :startdate, :enddate, :unknown_tb, :belongWork_tb, :floatIn_tb, :floatOut_tb);
    END;
    I am getting the above error when I am running at OCI program through a web application. This did work on another server 2 years ago. Project got put on hold and now that DB on that server can be restarted, I need to install in on a new server and db. I created this type for a user and granted permissions to public. I think it is either some sort of permission problem or patch problem. When I orginally worked on project it was in oracle 9i and one of last things I did was upgrade db to 11g. I don't know if I had to make some sort of change when I did that upgrade. But I need to get it working again on a 9i database (9.2.0.3.0)
    Below I have include 3 parts that I think make up the the problem
    1) The oci code that is giving error message
    2) The sql that creates the type
    3) The package that the OCI program is trying to run ( i had to remove comments for max length in oracle forums)
    So I am looking for help on what I might be missing or re createing this application. I kind of think I may have had to do something different with creating the type. For all of the .sql I just ran them as same user that owns all of my other tables.
    1) Below is line from OCI program that is failing
    if (ociCheckError("timeDiscrepancy.c(8008)", OCITypeByName(hba.envhp, hba.errhp, hba.svchp,
    (text *) 0, (ub4) 0, (text *) "DISCREPTABTYP", (ub4) strlen((const char *) "DISCREPTABTYP"),
    (CONST text *) 0, (ub4) 0, OCI_DURATION_SESSION, OCI_TYPEGET_HEADER,
    &discreptab_tdo), TRUE, &hba) == -1) {
    callMessage(&hba);
    deconstructHba(&hba);
    return (0);
    2) Below is sql that crated type
    drop type discrepTabTyp;
    Create or Replace Type discrepancyType as object(
    empcd varchar2(12),
    skilltpe varchar2(9),
    hprdcode varchar2(6),
    wprdcode varchar2(6),
    strtdate date,
    enddate date,
    empupdate date,
    empfnme varchar2(12),
    empmint varchar2(2),
    emplnme varchar2(20),
    prodcode varchar2(6),
    startscan date,
    endscan date,
    origstart date,
    reason varchar2(23),
    timeupdate date)
    GRANT EXECUTE ON DISCREPANCYTYPE TO public;
    CREATE PUBLIC SYNONYM DISCREPANCYTYPE FOR DISCREPANCYTYPE;
    Create or Replace type discrepTabTyp is table of discrepancyType
    GRANT EXECUTE ON DISCREPTABTYP TO public;
    CREATE PUBLIC SYNONYM DISCREPTABTYP FOR DISCREPTABTYP;
    3) Below is the package that the OCI program is trying to run
    create or replace package timeKeeper_package as
    Type empschdRec IS RECORD (
    hprdcode empschd.hprdcode%type,
    empcd empschd.empcode%type,
    skilltpe empschd.skilltpe%type,
    wprdcode empschd.wprdcode%type,
    strtdate date,
    enddate date,
    lastupdate date,
    match pls_integer);
    Type timeRec IS RECORD (
    prodcode time_keeper.prodcode%type,
    empcd time_keeper.empcode%type,
    origstart date,
    startscan date,
    endscan date,
    lastupdate date,
    match pls_integer);
    Type discrepancyRec IS RECORD (
    empcd empschd.empcode%type DEFAULT '',
    skilltpe empschd.skilltpe%type DEFAULT'',
    hprdcode empschd.hprdcode%type DEFAULT '',
    wprdcode empschd.wprdcode%type DEFAULT '',
    strtdate date DEFAULT NULL,
    enddate date DEFAULT NULL,
    empupdate date DEFAULT NULL,
    empfnme empcode.empfnme%type DEFAULT ' ',
    empmint empcode.empmint%type DEFAULT ' ',
    emplnme empcode.emplnme%type DEFAULT ' ',
    prodcode time_keeper.prodcode%type DEFAULT '',
    startscan date DEFAULT NULL,
    endscan date DEFAULT NULL,
    origstart date DEFAULT NULL,
    timeupdate date DEFAULT NULL,
    reason varchar2(23) DEFAULT '');
    type empArray is table of empschdRec index by pls_integer;
    type timeArray is table of timeRec index by pls_integer;
    type discrepancyArray is table of discrepancyRec index by pls_integer;
    procedure discrepancy (unit in prodcode.prodcode%type, start_date date, end_date date,
    unknown_tb in out discrepancyArray, belongWork_tb in out discrepancyArray,
    floatIn_tb in out discrepancyArray, floatOut_tb in out discrepancyArray);
    procedure discrepancy2 (unit in prodcode.prodcode%type,
    start_date date, end_date date,
    unknown_tab out discrepTabTyp, belongWork_tab out discrepTabTyp,
    floatIn_tab out discrepTabTyp, floatOut_tab out discrepTabTyp);
    procedure match (unit in prodcode.prodcode%type, start_date date, end_date date,
    empschd_tb out empArray, time_keeper_tb out timeArray);
    end timeKeeper_package;
    create or replace package body timeKeeper_package as
    Type empcodeRec IS RECORD (
    prodcode empcode.prodcode%type,
    empcd empcode.empcode%type,
    bskiltpe empcode.bskiltpe%type,
    empfnme empcode.empfnme%type,
    empmint empcode.empmint%type,
    emplnme empcode.emplnme%type,
    swipe empcode.swipe%type,
    home_swipe empcode.home_swipe%type);
    type empcodeArray is table of empcodeRec index by pls_integer;
    function empcode_find (empcd empcode.empcode%type, emcdTable empcodeArray,
    maxIndex int) return int;
    procedure add_discrepancy (unit in prodcode.prodcode%type,
    unknown_tb in out discrepancyArray,
    belongWork_tb in out discrepancyArray,floatIn_tb in out discrepancyArray,
    floatOut_tb in out discrepancyArray,
    empcode_tb empcodeArray, empcdIndex pls_integer,
    empschd_tb empArray,schdIndex pls_integer,
    time_keeper_tb timeArray, timeIndex pls_integer, reason varchar2);
    procedure match (unit in prodcode.prodcode%type, start_date date, end_date date,
    empschd_tb out empArray, time_keeper_tb out timeArray) as
    CURSOR schd_cursor is
    select empschd.hprdcode,empschd.empcode,empschd.skilltpe,empschd.wprdcode,
    empschd.strtdate,empschd.enddate, empschd.lastupdate, 0
    from empschd,empcode
    where (empschd.hprdcode = unit or empschd.wprdcode = unit) and
    (empschd.strtdate between start_date and end_date or
    empschd.enddate between start_date and end_date)
    and empschd.openclsd = 'OPEN' and empcode.empcode = empschd.empcode and
    empcode.swipe = 'Y' and empcode.termcode is null
    order by empschd.empcode,empschd.strtdate,empschd.enddate;
    CURSOR time_cursor is
    select time_keeper.prodcode, time_keeper.empcode, time_keeper.origstart,
    time_keeper.startscan, time_keeper.endscan, time_keeper.lastupdate, 0
    from time_keeper, prodcode
    where (time_keeper.empcode in (select empcode from empcode where prodcode = unit)
    or time_keeper.prodcode = unit) and
    (time_keeper.startscan between (start_date - (prodcode.scan_reset/24))
    and (end_date + (prodcode.scan_reset/24)) or
    time_keeper.endscan between (start_date - (prodcode.scan_reset/24))
    and (end_date + (prodcode.scan_reset/24))) and
    time_keeper.active = 'Y' and prodcode.prodcode = unit
    order by time_keeper.empcode, time_keeper.startscan, time_keeper.endscan;
    timeIndex integer; -- current index in time_keeper_tb
    diffCurrent float; -- difference between current empschd and time keeper start dates
    diffNext float; -- difference between current empschd and next time keeper start dates
    diffEmp2 float; -- difference between next empschd 7 current time keeper start dates
    BEGIN
    open schd_cursor;
    fetch schd_cursor bulk collect into empschd_tb;
    close schd_cursor;
    open time_cursor;
    fetch time_cursor bulk collect into time_keeper_tb;
    close time_cursor;
    if (empschd_tb.FIRST is not NULL and time_keeper_tb.FIRST is not NULL) then
    timeIndex := 1;
    for i in empschd_tb.FIRST .. empschd_tb.LAST
    loop
    while (timeIndex <= time_keeper_tb.LAST and (time_keeper_tb(timeIndex).match != 0 or
    time_keeper_tb(timeIndex).empcd != empschd_tb(i).empcd))
    loop
    timeIndex := timeIndex + 1;
    end loop;
    if (timeIndex > time_keeper_tb.LAST) then
    timeIndex := 1;
    else
    diffCurrent := abs (empschd_tb(i).strtdate - time_keeper_tb(timeIndex).startscan);
    while (timeIndex < time_keeper_tb.LAST and
    time_keeper_tb(timeIndex).empcd = empschd_tb(i).empcd)
    loop
    if (timeIndex+1 <= time_keeper_tb.LAST and
    empschd_tb(i).empcd = time_keeper_tb(timeIndex+1).empcd) then
    diffNext := abs (empschd_tb(i).strtdate - time_keeper_tb(timeIndex+1).startscan);
    else
    diffNext := diffCurrent;
    end if;
    exit when diffCurrent <= diffNext;
    timeIndex := timeIndex + 1;
    diffCurrent := diffNext;
    end loop; -- end while finding closesest empschd
    if (i+1 <= empschd_tb.LAST and
    empschd_tb(i+1).empcd = time_keeper_tb(timeIndex).empcd) then
    diffEmp2 := abs (empschd_tb(i+1).strtdate - time_keeper_tb(timeIndex).startscan);
    else
    diffEmp2 := diffCurrent;
    end if;
    -- decide which time keeper record to match to current empschd record
    if (diffCurrent <= diffEmp2) then
    empschd_tb(i).match := timeIndex;
    time_keeper_tb(timeIndex).match := i;
    timeIndex := timeIndex+1;
    else
    -- if previous time_keeper record is unmatched,
    -- then match it to current empschd else it remains unmatched
    if (timeIndex > 1 and time_keeper_tb(timeIndex-1).match = 0 and
    empschd_tb(i).empcd = time_keeper_tb(timeIndex-1).empcd) then
    empschd_tb(i).match := timeIndex-1;
    time_keeper_tb(timeIndex-1).match := i;
    end if;
    end if; -- end else next empschd was closer
    end if;
    end loop; -- end for each empschd
    end if;
    -- utl_file.fclose (fip);
    END match;
    procedure discrepancy (unit in prodcode.prodcode%type,
    start_date date, end_date date,
    unknown_tb in out discrepancyArray, belongWork_tb in out discrepancyArray,
    floatIn_tb in out discrepancyArray, floatOut_tb in out discrepancyArray) as
    -- read in all non terminated employee records
    CURSOR emp_cursor is
    select prodcode, empcode, bskiltpe, empfnme, nvl(empmint,' '), emplnme,
    swipe, home_swipe
    from empcode
    where termcode is null
    order by empcode;
    empcode_tb empcodeArray; -- holds non terminated employee array
    employee_index pls_integer; -- current employee in empcode_tb
    timeKeeper_indx pls_integer; -- current time keeper record
    empschd_tb empArray; -- holds employee schedule data
    time_keeper_tb timeArray; -- holds time keeper data
    unitgrace number (38,34); -- unit's grace time
    found boolean; -- indicates if discrepancy found
    reason varchar2(23); -- the reason of discrepancy
    fip utl_file.file_type;
    begin
    -- this places record in all_directories table which seems to be used by fopen
    fip := utl_file.fopen ('TIME_KEEP_DIR','discrepancy.pr','w',500);
    -- read and convert grace time for unit from minutes to fraction
    -- of 1 day for date comparisons
    select (grace_time / 60)/24
    into unitgrace
    from prodcode where prodcode = unit;
    -- get the employee records to validate employee codes scanned
    open emp_cursor;
    fetch emp_cursor bulk collect into empcode_tb;
    close emp_cursor;
    utl_file.put_line(fip, 'match start '|| to_char (start_date, 'MM/DD/YYYY HH:MI:SS AM') ||
    ' End: ' || to_char (end_date, 'MM/DD/YYYY HH:MI:SS AM'), TRUE);
    -- given a unit, start time and end time, read in and match employee schedule
    -- and time keeper records to each other.
    timeKeeper_package.match (unit, start_date, end_date, empschd_tb, time_keeper_tb);
    -- print out employee schedule records
    utl_file.new_line(fip,1);
    utl_file.put_line (fip, 'EMPLOYEE SCHEDULE RECORDS');
    utl_file.new_line(fip,1);
    if (empschd_tb.FIRST is not NULL) then
    for j in empschd_tb.FIRST ..empschd_tb.LAST
    loop
    utl_file.put_line(fip, 'index: '||j||' match: '||empschd_tb(j).match||' empcode: '||
    empschd_tb(j).empcd ||' '|| ' skill: '|| empschd_tb(j).skilltpe ||
    ' Home: ' || empschd_tb(j).hprdcode || ' Work: ' || empschd_tb(j).wprdcode ||
    ' Start: '|| to_char (empschd_tb(j).strtdate, 'MM/DD/YYYY HH:MI:SS AM') ||
    ' End: ' || to_char (empschd_tb(j).enddate, 'MM/DD/YYYY HH:MI:SS AM'), TRUE);
    end loop;
    end if;
    -- print the time keeper scan data
    utl_file.new_line(fip,1);
    utl_file.put_line (fip, 'TIME KEEPER RECORDS');
    utl_file.new_line(fip,1);
    if (time_keeper_tb.FIRST is not NULL) then
    for i in time_keeper_tb.FIRST ..time_keeper_tb.LAST
    loop
    utl_file.put_line(fip,'Index: '||i||' match: '|| time_keeper_tb(i).match||
    ' empcode: ' || time_keeper_tb(i).empcd ||
    ' Start: '|| to_char (time_keeper_tb(i).startscan, 'MM/DD/YYYY HH:MI:SS AM') ||
    ' End: ' || to_char (time_keeper_tb(i).endscan, 'MM/DD/YYYY HH:MI:SS AM'),TRUE);
    end loop;
    end if;
    -- perform discrepancy logic between empschd and time keeper records
    timeKeeper_indx := 1;
    -- go through all empschd records
    if (empschd_tb.FIRST is not NULL) then
    for i in empschd_tb.FIRST ..empschd_tb.LAST loop
    -- find the next time keeper record that has same empcode as current empschd
    while (time_keeper_tb(timeKeeper_indx).empcd <= empschd_tb(i).empcd) loop
    if (time_keeper_tb(timeKeeper_indx).match = 0) then
    -- check if time keeper record is with in start and end date range if not
    -- skip record else have a descrepancy which need to figured out. It can
    -- only be 1 of 2 possiblities since there is no matching empshcd record.
    if NOT((time_keeper_tb(timeKeeper_indx).startscan < start_date and
    time_keeper_tb(timeKeeper_indx).endscan < start_date) or
    (time_keeper_tb(timeKeeper_indx).startscan > end_date and
    time_keeper_tb(timeKeeper_indx).endscan > end_date)) then
    employee_index := empcode_find (time_keeper_tb(timeKeeper_indx).empcd,
    empcode_tb, empcode_tb.LAST);
    found := false;
    -- figure out reason of descrepancy
    if (employee_index < 0) then
    found := true;
    reason := 'Unknown Employee-Swipe';
    else
    found := true;
    reason := 'Not Scheduled, Swipe-in';
    end if;
    if (found = true) then
    add_discrepancy (unit,unknown_tb, belongWork_tb, floatIn_tb, floatOut_tb,
    empcode_tb, employee_index,
    empschd_tb, -1, time_keeper_tb, timeKeeper_indx, reason);
    end if;
    end if;
    end if; -- end if time keeper match = 0
    timeKeeper_indx := timeKeeper_indx + 1;
    end loop; -- end while time keeper empcode <= empschd empcode
    employee_index := empcode_find (empschd_tb(i).empcd, empcode_tb, empcode_tb.LAST);
    found := false;
    -- if current empschd has no match then check for descrepancy
    if (empschd_tb(i).match = 0) then
    if (employee_index < 0) then
    found := true;
    reason := 'Unknown Employee-Sched';
    elsif ((empschd_tb(i).strtdate + unitgrace) < sysdate) then
    found := true;
    reason := 'Scheduled, no swipe-in';
    end if;
    if (found = true) then
    add_discrepancy (unit,unknown_tb, belongWork_tb, floatIn_tb, floatOut_tb,
    empcode_tb, employee_index,
    empschd_tb, i, time_keeper_tb, -1, reason);
    end if;
    else
    -- empschd has a match, check for descrepancies
    case
    when time_keeper_tb(empschd_tb(i).match).prodcode != empschd_tb(i).wprdcode and
    empcode_tb(employee_index).home_swipe = 'N' then
    found := true;
    reason := 'Swiped into wrong unit';
    when time_keeper_tb(empschd_tb(i).match).endscan is NULL and
    (empschd_tb(i).enddate + unitgrace) < sysdate then
    found := true;
    reason := 'Swipe-in, no Swipe-out';
    when (time_keeper_tb(empschd_tb(i).match).startscan + unitgrace) <
    empschd_tb(i).strtdate then
    found := true;
    reason := 'Swipe-in early';
    when (time_keeper_tb(empschd_tb(i).match).startscan - unitgrace) >
    empschd_tb(i).strtdate then
    found := true;
    reason := 'Swipe-in late';
    when (time_keeper_tb(empschd_tb(i).match).endscan + unitgrace) <
    empschd_tb(i).enddate then
    found := true;
    reason := 'Swipe-out early';
    when (time_keeper_tb(empschd_tb(i).match).endscan - unitgrace) >
    empschd_tb(i).enddate then
    found := true;
    reason := 'Swipe-out late';
    else
    found := false;
    end case;
    if (found = true) then
    add_discrepancy (unit,unknown_tb, belongWork_tb, floatIn_tb, floatOut_tb,
    empcode_tb, employee_index,
    empschd_tb, i, time_keeper_tb, empschd_tb(i).match, reason);
    end if;
    end if;
    end loop; -- end for each empschd
    -- process all unproccesed time_keeper records with match value of 0
    while (timeKeeper_indx <= time_keeper_tb.LAST) loop
    if (time_keeper_tb(timeKeeper_indx).match = 0) then
    -- check if time keeper record is with in start and end date range if not
    -- skip record else have a descrepancy which need to figured out. It can
    -- only be 1 of 2 possiblities since there is no matching empshcd record.
    if NOT((time_keeper_tb(timeKeeper_indx).startscan < start_date and
    time_keeper_tb(timeKeeper_indx).endscan < start_date) or
    (time_keeper_tb(timeKeeper_indx).startscan > end_date and
    time_keeper_tb(timeKeeper_indx).endscan > end_date)) then
    employee_index := empcode_find (time_keeper_tb(timeKeeper_indx).empcd,
    empcode_tb, empcode_tb.LAST);
    found := false;
    -- figure out reason of descrepancy
    if (employee_index < 0) then
    found := true;
    reason := 'Unknown Employee-Swipe';
    else
    found := true;
    reason := 'Not Scheduled, Swipe-in';
    end if;
    if (found = true) then
    add_discrepancy (unit,unknown_tb, belongWork_tb, floatIn_tb, floatOut_tb,
    empcode_tb, employee_index,
    empschd_tb, -1, time_keeper_tb, timeKeeper_indx, reason);
    end if;
    end if;
    end if; -- end if time keeper match = 0
    timeKeeper_indx := timeKeeper_indx + 1;
    end loop; -- end while time keeper records unproccesed
    else
    utl_file.put_line (fip, 'In check time_keeper because empschd is NULL');
    if (time_keeper_tb.FIRST is not NULL) then
    utl_file.put_line (fip, 'In time keeper not null');
    for i in time_keeper_tb.FIRST ..time_keeper_tb.LAST
    loop
    if NOT((time_keeper_tb(i).startscan < start_date and
    time_keeper_tb(i).endscan < start_date) or
    (time_keeper_tb(i).startscan > end_date and
    time_keeper_tb(i).endscan > end_date)) then
    employee_index := empcode_find (time_keeper_tb(i).empcd,
    empcode_tb, empcode_tb.LAST);
    found := false;
    -- figure out reason of descrepancy
    if (employee_index < 0) then
    found := true;
    reason := 'Unknown Employee-Swipe';
    else
    found := true;
    reason := 'Not Scheduled, Swipe-in';
    end if;
    utl_file.put_line (fip, 'before if found true');
    if (found = true) then
    add_discrepancy (unit,unknown_tb, belongWork_tb, floatIn_tb, floatOut_tb,
    empcode_tb, employee_index,
    empschd_tb, -1, time_keeper_tb, timeKeeper_indx, reason);
    utl_file.put_line (fip, 'after add discrepancy');
    end if;
    end if;
    end loop;
    end if;
    end if;
    -- print out discrepancy data
    utl_file.put_line (fip, 'Unknown Employees');
    if (unknown_tb.FIRST is not NULL) then
    for j in unknown_tb.FIRST ..unknown_tb.LAST
    loop
    utl_file.put_line(fip, 'index: '||j|| ' empcode: '||unknown_tb(j).empcd ||
    ' skill: '||unknown_tb(j).skilltpe ||
    ' Home: '|| unknown_tb(j).hprdcode || ' Work: '||
    unknown_tb(j).wprdcode||' Start: '||
    to_char (unknown_tb(j).strtdate, 'MM/DD/YYYY HH:MI:SS AM') ||
    ' End: ' || to_char (unknown_tb(j).enddate, 'MM/DD/YYYY HH:MI:SS AM') ||
    ' Name: '|| unknown_tb(j).empfnme ||
    ' '||unknown_tb(j).empmint||' '|| unknown_tb(j).emplnme, TRUE);
    utl_file.put_line(fip,'time prod: '||unknown_tb(j).prodcode||' scan start '||
    to_char (unknown_tb(j).startscan, 'MM/DD/YYYY HH:MI:SS AM')||' scan end '||
    to_char (unknown_tb(j).endscan, 'MM/DD/YYYY HH:MI:SS AM')||' Original start '||
    to_char (unknown_tb(j).origstart, 'MM/DD/YYYY HH:MI:SS AM'), TRUE);
    utl_file.put_line(fip, 'Reason: '|| unknown_tb(j).reason,TRUE);
    utl_file.new_line(fip,1);
    end loop;
    end if;
    utl_file.put_line (fip, 'Employees Belong and Work in Unit');
    if (belongWork_tb.FIRST is not NULL) then
    for j in belongWork_tb.FIRST ..belongWork_tb.LAST
    loop
    utl_file.put_line(fip, 'index: '||j|| ' empcode: '||belongWork_tb(j).empcd ||
    ' skill: '||belongWork_tb(j).skilltpe ||
    ' Home: '|| belongWork_tb(j).hprdcode ||
    ' Work: '|| belongWork_tb(j).wprdcode||' Start: '||
    to_char (belongWork_tb(j).strtdate, 'MM/DD/YYYY HH:MI:SS AM') ||
    ' End: ' || to_char (belongWork_tb(j).enddate, 'MM/DD/YYYY HH:MI:SS AM') || ' Name: '||
    belongWork_tb(j).empfnme ||
    ' '||belongWork_tb(j).empmint||' '|| belongWork_tb(j).emplnme, TRUE);
    utl_file.put_line(fip,'time prod: '||belongWork_tb(j).prodcode||' scan start '||
    to_char (belongWork_tb(j).startscan, 'MM/DD/YYYY HH:MI:SS AM')||' scan end '||
    to_char (belongWork_tb(j).endscan, 'MM/DD/YYYY HH:MI:SS AM')||' Original start '||
    to_char (belongWork_tb(j).origstart, 'MM/DD/YYYY HH:MI:SS AM'), TRUE);
    utl_file.put_line(fip, 'Reason: '|| belongWork_tb(j).reason,TRUE);
    utl_file.new_line(fip,1);
    end loop;
    end if;
    utl_file.put_line (fip, 'Employees Floated into Unit');
    if (floatIn_tb.FIRST is not NULL) then
    for j in floatIn_tb.FIRST ..floatIn_tb.LAST
    loop
    utl_file.put_line(fip, 'index: '||j|| ' empcode: '||floatIn_tb(j).empcd ||
    ' skill: '|| floatIn_tb(j).skilltpe ||
    ' Home: '|| floatIn_tb(j).hprdcode ||
    ' Work: '|| floatIn_tb(j).wprdcode||' Start: '||
    to_char (floatIn_tb(j).strtdate, 'MM/DD/YYYY HH:MI:SS AM') ||
    ' End: ' || to_char (floatIn_tb(j).enddate, 'MM/DD/YYYY HH:MI:SS AM') || ' Name: '||
    floatIn_tb(j).empfnme ||
    ' '||floatIn_tb(j).empmint||' '|| floatIn_tb(j).emplnme, TRUE);
    utl_file.put_line(fip,'time prod: '||floatIn_tb(j).prodcode||' scan start '||
    to_char (floatIn_tb(j).startscan, 'MM/DD/YYYY HH:MI:SS AM')||' scan end '||
    to_char (floatIn_tb(j).endscan, 'MM/DD/YYYY HH:MI:SS AM')||' Original start '||
    to_char (floatIn_tb(j).origstart, 'MM/DD/YYYY HH:MI:SS AM'), TRUE);
    utl_file.put_line(fip, 'Reason: '|| floatIn_tb(j).reason,TRUE);
    utl_file.new_line(fip,1);
    end loop;
    end if;
    utl_file.put_line (fip, 'Employees Floated out of unit');
    if (floatOut_tb.FIRST is not NULL) then
    for j in floatOut_tb.FIRST ..floatOut_tb.LAST
    loop
    utl_file.put_line(fip, 'index: '||j|| ' empcode: '||floatOut_tb(j).empcd ||
    ' skill: '||floatOut_tb(j).skilltpe ||
    ' Home: '|| floatOut_tb(j).hprdcode ||
    ' Work: '|| floatOut_tb(j).wprdcode||' Start: '||
    to_char (floatOut_tb(j).strtdate, 'MM/DD/YYYY HH:MI:SS AM') ||
    ' End: ' || to_char (floatOut_tb(j).enddate, 'MM/DD/YYYY HH:MI:SS AM') || ' Name: '||
    floatOut_tb(j).empfnme ||
    ' '||floatOut_tb(j).empmint||' '|| floatOut_tb(j).emplnme, TRUE);
    utl_file.put_line(fip,'time prod: '||floatOut_tb(j).prodcode||' scan start '||
    to_char (floatOut_tb(j).startscan, 'MM/DD/YYYY HH:MI:SS AM')||' scan end '||
    to_char (floatOut_tb(j).endscan, 'MM/DD/YYYY HH:MI:SS AM')||' Original start '||
    to_char (floatOut_tb(j).origstart, 'MM/DD/YYYY HH:MI:SS AM'), TRUE);
    utl_file.put_line(fip, 'Reason: '|| floatOut_tb(j).reason,TRUE);
    utl_file.new_line(fip,1);
    end loop;
    end if;
    utl_file.fclose (fip);
    end discrepancy;
    procedure add_discrepancy (unit in prodcode.prodcode%type,
    unknown_tb in out discrepancyArray,
    belongWork_tb in out discrepancyArray,floatIn_tb in out discrepancyArray,
    floatOut_tb in out discrepancyArray,
    empcode_tb empcodeArray, empcdIndex pls_integer,
    empschd_tb empArray,schdIndex pls_integer,
    time_keeper_tb timeArray, timeIndex pls_integer, reason varchar2) as
    array_tb discrepancyArray; -- current array to add discrepancy to
    indx pls_integer; -- index of new record in current array
    selector pls_integer; -- flag indicates which array record will
    -- be added to. These are HBA Hard coded values
    -- 1 - The unknown array
    -- 2 - The belong and work in unit array
    -- 3 - The floated into this unit array
    -- 4 - The floated out of this unit array
    begin
    -- check if you have a valid employee, if not data goes into unknown_tb array
    if (empcdIndex <= 0) then
    array_tb := unknown_tb;
    selector := 1;
    -- if have no empschd record but do have time keeper, determine
    -- which array data goes into
    elsif (schdIndex <= 0 and timeIndex > 0) then
    if (unit = time_keeper_tb(timeIndex).prodcode and
    empcode_tb(empcdIndex).prodcode = unit) then
    array_tb := belongWork_tb;
    selector := 2;
    elsif (unit = time_keeper_tb(timeIndex).prodcode and
    empcode_tb(empcdIndex).prodcode != unit) then
    array_tb := floatIn_tb;
    selector := 3;
    else
    array_tb := floatOut_tb;
    selector := 4;
    end if;
    -- if have employee schedule record, determine which array data
    -- goes into. You should never be able to get past this point
    elsif (schdIndex > 0) then
    if (unit = empschd_tb(schdIndex).wprdcode and
    empschd_tb(schdIndex).hprdcode = unit) then
    array_tb := belongWork_tb;
    selector := 2;
    elsif (unit = empschd_tb(schdIndex).wprdcode and
    empschd_tb(schdIndex).hprdcode != unit) then
    array_tb := floatIn_tb;
    selector := 3;
    else
    array_tb := floatOut_tb;
    selector := 4;
    end if;
    end if;
    -- create and add new record to the correct array
    if (schdIndex > 0 or timeIndex > 0) then
    -- determine index for the new record being created.
    if (array_tb.LAST is NULL) then
    indx := 1;
    else
    indx := array_tb.LAST + 1;
    end if;
    if (schdIndex > 0) then
    array_tb(indx).empcd := empschd_tb(schdIndex).empcd;
    array_tb(indx).skilltpe := empschd_tb(schdIndex).skilltpe;
    array_tb(indx).hprdcode := empschd_tb(schdIndex).hprdcode;
    array_tb(indx).wprdcode := empschd_tb(schdIndex).wprdcode;
    array_tb(indx).strtdate := empschd_tb(schdIndex).strtdate;
    array_tb(indx).enddate := empschd_tb(schdIndex).enddate;
    array_tb(indx).empupdate := empschd_tb(schdIndex).lastupdate;
    else
    array_tb(indx).empcd := time_keeper_tb(timeIndex).empcd;
    if (empcdIndex > 0) then
    array_tb(indx).skilltpe := empcode_tb(empcdIndex).bskiltpe;
    array_tb(indx).hprdcode := empcode_tb(empcdIndex).prodcode;
    end if;
    end if;
    if (empcdIndex > 0) then
    array_tb(indx).empfnme := empcode_tb(empcdIndex).empfnme;
    array_tb(indx).empmint := empcode_tb(empcdIndex).empmint;
    array_tb(indx).emplnme := empcode_tb(empcdIndex).emplnme;
    end if;
    if (timeIndex > 0) then
    array_tb(indx).prodcode := time_keeper_tb(timeIndex).prodcode;
    array_tb(indx).startscan := time_keeper_tb(timeIndex).startscan;
    array_tb(indx).endscan := time_keeper_tb(timeIndex).endscan;
    array_tb(indx).origstart := time_keeper_tb(timeIndex).origstart;
    array_tb(indx).timeupdate := time_keeper_tb(timeIndex).lastupdate;
    end if;
    array_tb(indx).Reason := reason;
    -- after new record created then reassign array to correct output variable
    if (selector = 1) then
    unknown_tb := array_tb;
    elsif (selector = 2) then
    belongWork_tb := array_tb;
    elsif (selector = 3) then
    floatIn_tb := array_tb;
    elsif (selector = 4) then
    floatOut_tb := array_tb;
    end if;
    end if;
    end;
    function empcode_find (empcd empcode.empcode%type, emcdTable empcodeArray,
    maxIndex int) return int as
    low int; -- Array index of low side of current search
    high int; -- Array index of high side of current search
    mid int; -- Array index of current record being checked
    begin
    low := 1; -- Initialize to first index in array
    high := maxIndex; -- Initialize to last index in array
    while ( low <= high) loop
    mid := (low + high) / 2;
    if (empcd < emcdTable(mid).empcd) then
    high := mid - 1;
    elsif (empcd > emcdTable(mid).empcd) then
    low := mid + 1;
    else
    return mid;
    end if;
    end loop;
    return -1;
    end empcode_find;
    procedure discrepancy2 (unit in prodcode.prodcode%type,
    start_date date, end_date date,
    unknown_tab out discrepTabTyp, belongWork_tab out discrepTabTyp,
    floatIn_tab out discrepTabTyp, floatOut_tab out discrepTabTyp) as
    unknown_tb discrepancyArray;
    belongWork_tb discrepancyArray;
    floatIn_tb discrepancyArray;
    floatOut_tb discrepancyArray;
    begin
    timeKeeper_package.discrepancy (unit, start_date, end_date, unknown_tb,
    belongWork_tb, floatIn_tb, floatOut_tb);
    if (unknown_tb.FIRST is not NULL) then
    unknown_tab := discrepTabTyp();
    for j in unknown_tb.FIRST ..unknown_tb.LAST
    loop
    unknown_tab.extend;
    unknown_tab(j) := discrepancyType (unknown_tb(j).empcd, unknown_tb(j).skilltpe,
    unknown_tb(j).hprdcode, unknown_tb(j).wprdcode,
    unknown_tb(j).strtdate, unknown_tb(j).enddate,
    unknown_tb(j).empupdate,unknown_tb(j).empfnme,
    unknown_tb(j).empmint, unknown_tb(j).emplnme, unknown_tb(j).prodcode,
    unknown_tb(j).startscan, unknown_tb(j).endscan, unknown_tb(j).origstart,
    unknown_tb(j).reason, unknown_tb(j).timeupdate);
    end loop;
    end if;
    if (belongWork_tb.FIRST is not NULL) then
    belongWork_tab := discrepTabTyp();
    for j in belongWork_tb.FIRST ..belongWork_tb.LAST
    loop
    belongWork_tab.extend;
    belongWork_tab(j) := discrepancyType (belongWork_tb(j).empcd,belongWork_tb(j).skilltpe,
    belongWork_tb(j).hprdcode, belongWork_tb(j).wprdcode,
    belongWork_tb(j).strtdate, belongWork_tb(j).enddate,
    belongWork_tb(j).empupdate, belongWork_tb(j).empfnme,
    belongWork_tb(j).empmint, belongWork_tb(j).emplnme, belongWork_tb(j).prodcode,
    belongWork_tb(j).startscan, belongWork_tb(j).endscan, belongWork_tb(j).origstart,
    belongWork_tb(j).reason, belongWork_tb(j).timeupdate);
    end loop;
    end if;
    if (floatIn_tb.FIRST is not NULL) then
    floatIn_tab := discrepTabTyp();
    for j in floatIn_tb.FIRST ..floatIn_tb.LAST
    loop
    floatIn_tab.extend;
    floatIn_tab(j) := discrepancyType (floatIn_tb(j).empcd,
    floatIn_tb(j).skilltpe, floatIn_tb(j).hprdcode,
    floatIn_tb(j).wprdcode, floatIn_tb(j).strtdate, floatIn_tb(j).enddate,
    floatIn_tb(j).empupdate, floatIn_tb(j).empfnme,
    floatIn_tb(j).empmint, floatIn_tb(j).emplnme, floatIn_tb(j).prodcode,
    floatIn_tb(j).startscan, floatIn_tb(j).endscan, floatIn_tb(j).origstart,
    floatIn_tb(j).reason, floatIn_tb(j).timeupdate);
    end loop;
    end if;
    -- Copy float out table data to output array
    if (floatOut_tb.FIRST is not NULL) then
    floatOut_tab := discrepTabTyp();
    for j in floatOut_tb.FIRST ..floatOut_tb.LAST
    loop
    floatOut_tab.extend;
    floatOut_tab(j) := discrepancyType (floatOut_tb(j).empcd, floatOut_tb(j).skilltpe,
    floatOut_tb(j).hprdcode, floatOut_tb(j).wprdcode,
    floatOut_tb(j).strtdate, floatOut_tb(j).enddate,
    floatOut_tb(j).empupdate, floatOut_tb(j).empfnme,
    floatOut_tb(j).empmint, floatOut_tb(j).emplnme, floatOut_tb(j).prodcode,
    floatOut_tb(j).startscan, floatOut_tb(j).endscan, floatOut_tb(j).origstart,
    floatOut_tb(j).reason, floatOut_tb(j).timeupdate);
    end loop;
    end if;
    end;
    end timeKeeper_package;
    GRANT EXECUTE ON TIMEKEEPER_PACKAGE TO public;
    CREATE PUBLIC SYNONYM TIMEKEEPER_PACKAGE FOR TIMEKEEPER_PACKAGE;

    I figured out that when I upgraded from 9.2.03 to 9.2.0.8 that the problem went away. I think when I had it working earlier I may have been on 9.2.0.5

  • OCI 22303 exception - Pass object to type Record in oracle procedure

    Recently i had my first encounter with ODP.NET and Oracle. I'm developing a a datalayer that can access a stored procedure on an Oracle database.
    The problem i'm having is the following:
    I'm using this method to pass my parameters to the procedure: http://www.codeproject.com/KB/cs/CustomObject_Oracle.aspx
    I have also attempted this approach:
    http://developergeeks.com/article/48/3-steps-to-implement-oracle-udt-in-odpnet
    I always get the message (litteraly):
    Oracle.DataAccess.Client.OracleException: OCI-22303: type &quote;PAC$WEBSHOP_PROCS&quot;.&quot;CUSTOMER_IN_RECTYPE&quot; not found.
    It sounds weird to me, but what are the &quotes doing here in the error message I see?
    Some code i use:
    OracleParameter objParam = new OracleParameter
    OracleDbType = OracleDbType.Object,
    Direction = ParameterDirection.Input,
    ParameterName = "PAC$WEBSHOP_PROCS.P_CUSTOMER_IN",
    UdtTypeName = "PAC$WEBSHOP_PROCS.WEBSHOP_PROCS.CUSTOMER_IN_RECTYPE",
    Value = card
    The information i have about the Oracle procedure:
    CREATE OR REPLACE PACKAGE PAC$WEBSHOP_PROCS IS
    TYPE CUSTOMER_IN_RECTYPE IS RECORD
    (CUS_STO_IDENTIFIER NUMBER(2)
    ,CUS_IDENTIFIER NUMBER(6)
    ,CH_IDENTIFIER NUMBER(2)
    ,CH_CARD_VERSION NUMBER(1)
    PROCEDURE PRC$WS_VALIDATE_CARD
    (P_CUSTOMER_IN IN PAC$WEBSHOP_PROCS.CUSTOMER_IN_RECTYPE
    ,P_RETURN_CODE IN OUT NUMBER
    Any help to cover my problem would be greatly appreciated.
    Thx
    Edited by: 836497 on 14-feb-2011 4:36

    The only way to call it as is would be via an anonymous plsql block, where you create the record type inside the block. Interacting with the block via ODP would be limited to scalar values.
    Here's a PLSQL example just to demonstrate. Here, v1 and v2 are bind variables of scalar type, which you'd setup/bind via ODP instead of the SQL prompt as I did, but I thought this might keep things simpler for the example.
    The other choice would be to write a wrapper procedure that takes type OBJECT that you can call from ODP, and inside that procedure convert them to/from RECORD and call the original procedure.
    Hope it helps,
    Greg
    SQL> drop package somepack;
    Package dropped.
    SQL> create package somepack as
      2  type somerectype is record(n1 number);
      3  function somefunc (v1 somerectype) return somerectype;
      4  end;
      5  /
    Package created.
    SQL>
    SQL> create package body somepack as
      2  function somefunc (v1 somerectype) return somerectype is
      3   begin
      4    return v1;
      5   end;
      6  end;
      7  /
    Package body created.
    SQL>
    SQL>
    SQL> var v1 number;
    SQL> exec :v1 := 5;
    PL/SQL procedure successfully completed.
    SQL> var v2 number;
    SQL>
    SQL>
    SQL> declare
      2   localvar1 somepack.somerectype;
      3   localvar2 somepack.somerectype;
      4  begin
      5     localvar1.n1 := :v1;
      6     localvar2 := somepack.somefunc(localvar1);
      7     :v2 := localvar2.n1;
      8  end;
      9  /
    PL/SQL procedure successfully completed.
    SQL>  print v2;
            V2
             5
    SQL>

  • OCI-22303: type "MDSYS

    I am trying to select data from a table (while using TOAD) called HR_LOCATIONS_ALL (this is a seeded Oracle HRMS table) and get a message OCI-22303: type "MDSYS.
    I don't get the same error when selecting data using SQL *Plus.
    Does anyone have any idea why this is occuring and how to get rid of the message?
    Thanks in advance!

    Could you please verify that your database (as opposed to just sqlplus) is 10.2.0.1?
    For me, it works:
    SQL*Plus: Release 10.2.0.1.0 - Production on Mon Apr 21 13:07:07 2008
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning and Data Mining options
    SQL> select wktext from cs_srs where srid = 41155;
    WKTEXT
    PROJCS["Texas 4205, Southern Zone (1927)", GEOGCS [ "NAD 27 (Continental US)", D
    ATUM ["NAD 27 (Continental US)", SPHEROID ["Clarke 1866", 6378206.4, 294.9786982
    ]], PRIMEM [ "Greenwich", 0.000000 ], UNIT ["Decimal Degree", 0.0174532925199433
    0]], PROJECTION ["Lambert Conformal Conic"], PARAMETER ["Standard_Parallel_1", 2
    6.166667], PARAMETER ["Standard_Parallel_2", 27.833333], PARAMETER ["Central_Mer
    idian", -98.500000], PARAMETER ["Latitude_Of_Origin", 25.666667], PARAMETER ["Fa
    lse_Easting", 2000000.0000], UNIT ["U.S. Foot", 0.3048006096012]]
    SQL> SELECT sdo_cs.find_proj_crs(41155, 'FALSE') epsg_srid from dual;
    EPSG_SRID
    SDO_SRID_LIST(32041)
    SQL> desc mdsys.sdo_srid_list;
    mdsys.sdo_srid_list VARRAY(1048576) OF NUMBER
    SQL>
    Do you run the Enterprise Edition?

  • After connection lost SetVector fails with OCI-22303: type not found

    Hi there,
    I use statelessConnectionPool and after application is loosing connection to oracle for short time, all folowing setVector calls will fail with
    SetVector fails with OCI-22303: type "DEMO"."PROPERTIES" not found
    however its there and was working fine before connection was lost,
    As far as i read about the getConection for statelessConnectionPool will reestablish connection if required to return valid connection handle, but somehow the setVector does not work.
    Any idea?
    Thanks in advance
    Andrew

    Hi,
    I want to reconnect to same instance, I think i missed tnsnames part, did not knew its required, so i should add to client tnsnames or server the FAILOVER_MODE part?
    like this example:
    PAYROLL =
    (DESCRIPTION =
    (ADDRESS =
    (COMMUNITY = TCP.world)
    (PROTOCOL = TCP)
    (HOST = VSERVER)
    (PORT = 1521)
    (CONNECT_DATA =
    (SID = HR)
    (FAILOVER_MODE =
    (TYPE = SELECT)
    (METHOD = BASIC)
    (RETRIES = 20)
    (DELAY = 15)
    strange thing that connection seams to be valid only in complains about type not found, or maybe connections are not valid only i cant see it, does the not valid connections in the pool are reconnected or make new when i call GetConnection? or i should terminate connections on "end of comm channel error" so when db is reachable again it will reestablish new connections?
    Andrew

  • OCI-22303: type "SCOTT"."ODP_NT_SAMPLE_PERSON_COLL_TYPE" no

    Good day!
    I'm trying to get the UDT sample code for NestedTable to run but I am getting this error.
    However, I can describe the type (in SqlPlus) so it seems to be valid.
    The source database is a 9.2.0.4 version. Would this be part of the problem?
    Thanks

    Please disregard this post. I found the problem. It's working now.
    mea culpa

  • Full database export hangs (Oracle9i rel2)

    I recently migrated successfully from oracle8i rel 8.0. to oracle9i release 2,But now am not able to do a full database export.has anyone experienced this and whats the remedy?.
    the text i get is listed below.
    Microsoft Windows [Version 5.2.3790]
    (C) Copyright 1985-2003 Microsoft Corp.
    C:\Documents and Settings\Administrator>exp system/manager@ORCL file=C:\orclbk\p
    oll.dmp full=y
    Export: Release 9.2.0.1.0 - Production on Tue Aug 9 18:36:13 2005
    Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
    Connected to: Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.1.0 - Production
    Export done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set
    About to export the entire database ...
    . exporting tablespace definitions
    . exporting profiles
    . exporting user definitions
    . exporting roles
    . exporting resource costs
    . exporting rollback segment definitions
    . exporting database links
    . exporting sequence numbers
    . exporting directory aliases
    . exporting context namespaces
    . exporting foreign function library names
    . exporting PUBLIC type synonyms
    . exporting private type synonyms
    . exporting object type definitions
    EXP-00090: cannot pin type "OE"."CUSTOMER_TYP"
    EXP-00056: ORACLE error 22303 encountered
    OCI-22303: type "OE"."CUSTOMER_TYP" not found
    EXP-00056: ORACLE error 24323 encountered
    ORA-24323: value not allowed
    EXP-00000: Export terminated unsuccessfully
    C:\Documents and Settings\Administrator>

    You have to run the export with the SYS user. This error may arise on any plattform ranging form 9.0.1 to 10.2.0.
    C:\>exp "'sys/oracle as sysdba'" full=y

  • Problem with setVector & Setdatabufferarray

    I am using occi c++ api interface
    The type is a table of number index by binary integer.
    I am trying to use "type created inside a package" to pass as a last argument to setVector() , which will be my OUT parameter. But the error I am getting is "OCI-22303: type ""."......" type not found. But the type is there inside the package under the same schema. These things gets worse, if i create similar datatype directly under schema (instead of package) , as then I get error "PLS-00306: wrong number or types of arguments in call to <my SP name>"
    I have a workaround in using "setdatabufferarray" But here I can't use STL. I want to use STL, as I wil be accessing huge amount of data say more than 3000 numbers/varchars at a time.
    Pls suggest a solution. I have been trying this for more than 2 days now..:-(

    Hi Dinesh,
    The following worked for me:
    string retVal = "";
    vector<Number> c1(10);
    string sqlStmt = "BEGIN MY_PROC(:1); END;";
    stmt = conn->createStatement (sqlStmt);
    try
    stmt->registerOutParam(1, OCCIVECTOR, c1.size(),"NUM_TAB","SCOTT");
    stmt->executeUpdate();
    getVector(stmt,1,c1);
    catch(SQLException ex)
    retVal = ex.getMessage();
    cout << retVal;
    The type and stored procedure:
    create type num_tab as table of number ;
    create or replace procedure my_proc(parm1 out num_tab) as
    dummy_tab num_tab;
    begin
    dummy_tab := num_tab(1,2,3,4);
    parm1:=dummy_tab;
    end;
    Did I get your question correctly ?
    Regards,
    Sumit

  • EXP-00090:cannot pin type"SYSTEM"."REPCAT$_OBJECT_NULL_VECTOR"

    Hi,
    Can any one help please? We got this error from our full export script this morning. The script had been running successfully for several months, nothing has changed, the database is 10.1.0.3.0 and the export command which runs in a cronjob is:
    exp system/systempwd grants=Y full=Y file=exp.dmp buffer=409600 statistics=none
    I've tried to do some research on the error message but did not get anything helpful. The export terminated successfully with warnings.
    thank you.

    Pl post the complete error message from the export log. See if these MOS Docs can help
    797319.1 - EXP-90 EXP-56 OCI-22303 Obtained During User Export When the Type is Invalid
    133056.1 - EXP-90 EXP-56 OCI-22303 warning while exporting SYS schema
    294543.1 - Export Aborts with EXP-0 and OCI-22303 (type "SYS"."AQ$_EVENT_MESSAGE" not found)
    HTH
    Srini

  • Database instance crashes when running expdp

    Hi,
    I have oracle 10.2.0.4 running on AIX.
    when i try to run expdp as below...
    expdp system/pwd directory=DATA_PUMP_DIR2 tables=TOAD_PLAN_TABLE dumpfile=test.dmp
    i get an error as..
    UDE-00008: operation generated ORACLE error 22303
    OCI-22303: type "SYS"."KU$_STATUS1020" not found
    and the database instance crashes.
    I tried increasing the shared_memory_pool, checking the read, write permissions on the directory. but every single time i run the expdp, the instance crashes.
    But when i try to run the exp for the same table, it runs fine.
    Can someone help me resolve this so i can use the expdp feature.
    Thanks.
    Philip.

    I could not find anything proper w.r.t the datapump failure.
    is there a package or something i need to install in the database for the expdp to work.
    or do i have to install any libraries for the datapump to work.
    Thanks.

  • Type not found error

    Hi, my problem is "OCI-22303: type not found".
    I have a package in a database, say, MY_PCKDG.aa_number
    Then I'm trying
    std::vector<int> var;
    var.push_back(12);
    setVector(stmt, index, var, "MY_PCKDG.AA_NUMBER"); //here it fails saying the type was not found
    How to find the type? I have tried the type name alone, both uppercase and non-uppercase, and <package name>.<type name>, both all uppercase and non-uppercase.. Any suggestions?
    --Andrew                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Fernando . Thanks for the response. I am getting this error when I am trying to create a risk. Attached is the snapshot of the error. I have tried stuff like deleting the cache, checked SICF to see if Web Dyn Pro is active etc

  • Odd issue when using UDT (user defined type)

    Hi all,
    11g.
    I ran into an odd issue when using UDT, I have these 4 schemas: USER_1, USER_2, USER_A, USER_B.
    Both USER_1 and USER_2 have an UDT (actually a nested table):
    CREATE OR REPLACE TYPE TAB_NUMBERS AS TABLE OF NUMBER(10)USER_A has a synonym points to the type in USER_1:
    create or replace synonym TAB_NUMBERS for USER_1.TAB_NUMBERS;USER_B has a synonym points to the type in USER_2:
    create or replace synonym TAB_NUMBERS for USER_2.TAB_NUMBERS;Both USER_A and USER_B have a procedure which uses the synonym:
    CREATE OR REPLACE PROCEDURE proc_test (p1 in tab_numbers)
    IS
    BEGIN
      NULL;
    END;And in the C# code:
    OracleConnection conn = new OracleConnection("data source=mh;user id=USER_A;password=...");
    OracleCommand cmd = new OracleCommand();
    cmd.Connection = conn;
    cmd.CommandText = "proc_test";
    cmd.CommandType = CommandType.StoredProcedure;
    OracleParameter op = new OracleParameter();
    op.ParameterName = "p1";
    op.Direction = ParameterDirection.Input;
    op.OracleDbType = OracleDbType.Object;
    op.UdtTypeName = "TAB_NUMBERS";
    Nested_Tab_Mapping_To_Object nt = new Nested_Tab_Mapping_To_Object();
    nt.container = new decimal[] { 1, 2 };
    op.Value = nt;
    ......This code works fine, but it raises an error when I change the connection string from USER_A to USER_B, the error says:
    OCI-22303: type ""."TAB_NUMBERS" not foundInterestingly, if I change op.UdtTypeName = "TAB_NUMBERS"; to op.UdtTypeName = "USER_2.TAB_NUMBERS", the error is gone, and everything works fine.
    Anyone has any clues?
    Thanks in advance.

    Erase and reformat the ext HD. Then, redo the SuperDuper! backup.

  • C/C++ OCI XML support examples

    Hi all,
    I'm trying to find some simple C/C++ examples of accessing XMLType columns from OCI. I'm interested in examples that show the basics like querying an XMLType column and inserting values into an XMLType column. I'm mainly interested in examples that deal with the XMLType column when the data is stored in the database as a CLOB though I'm not sure if the client side really cares about that.
    My application is based on the 9i OCI client since we still need to support that so I think that some of the newer OCI XML calls will not be available. I'm already quite familiar with programming in OCI, and I'm in the process of adding support for XML to our applicaiton so I just need some sample code that shows the basics and then hopefully I can figure things out from there.
    Any help would be much appreciated.
    Thanks,
    Nick

    It's possible to get XMLTYPE column in OCI without converting them to string or clob. I was able to do it by taking just the XDK headers and using only those functions declared there which are exposed by oci.dll directly. Here's the comment from my code:
    <tt>
    // Only calls which are defined in xmlproc.h (in xdb/include) as
    // #define XmlXYZ which take an xctx as first param, and cast back
    // xctx into xmlctxhead, then access the struct of function pointers,
    // are accessible to a pure OCI / Instance Client app.
    </tt>
    Crystal clear, no? ;-)
    The code below could be compiled with Instant Client augmented with xdk/include/*.h. It depends on a few classes and methods not listed (it's part of a bigger file), but if you program with OCI you should be able to replace them with something that works. It's quite rough, my own experimentation, before moving on to wrap all this messy C-code into nicer looking C++, but it shows that it can be done. Notice you need to init on Object mode, and given that it uses undocumented functions for the parsing, probably not supported at all by Oracle.
    Anyways, I hope its useful to someone. --DD
    PS: Sorry, looks like the forum garbles the code a little in HTML. don't know how to fix that. Maybe look at the source for the HTML.
    <tt>
    #include <xmlotn.h>
    * \brief Replacement for official XmlSaveDom not accessible to Instant-Clients
    * This method wraps calls to the unofficial XmlSaveDomVA method exposed by
    * Oracle contexts, to work around the fact that XmlSaveDom is not accessible
    * to applications deployed against Oracle's Instant Client runtime.
    * The real XmlSaveDom may be taking advantage of more undocumented key/value
    * pairs supported by underlying XmlSaveDomVA methods, to do proper error
    * handling possibly, which may explain why XmlSaveDomVA does not return the
    * number of bytes written, as advertised by XmlSaveDom's documentation.
    static xmldocnode* myXmlLoadDom(xmlctx* xctx, xmlerr* err, ...) {
    va_list v;
    va_start(v, err);
    xmldocnode*const rc = XmlLoadDomVA(xctx, err, v);
    va_end(v);
    return rc;
    static xmldocnode* load_dom_from_string(
    xmlctx* xctx, const char* doc_string, ub4 string_len
    SystemTimer timer;
    xmlerr err = XMLERR_OK;
    xmldocnode*const doc = myXmlLoadDom(
    xctx, &err,
    "buffer", doc_string,
    "buffer_length", string_len,
    NULL // sentinel marking end of key/value pairs
    if (err != XMLERR_OK || doc == NULL) {
    cerr << "Error parsing XML string" << endl;
    // throw?
    cout << "loaded dom in " << timer << endl;
    return doc;
    static xmldocnode* load_dom_from_file(
    xmlctx* xctx, const char* filename
    SystemTimer timer;
    xmlerr err = XMLERR_OK;
    xmldocnode*const doc = myXmlLoadDom(
    xctx, &err,
    "file", filename,
    NULL // sentinel marking end of key/value pairs
    if (err != XMLERR_OK || doc == NULL) {
    cerr << "Error parsing XML file " << filename << endl;
    // throw?
    cout << "loaded dom in " << timer << endl;
    return doc;
    static ubig_ora myXmlSaveDom(xmlctx* xctx, xmlerr* err, xmlnode* root, ...) {
    SystemTimer timer;
    va_list v;
    va_start(v, root);
    const ubig_ora rc = XmlSaveDomVA(xctx, err, root, v);
    va_end(v);
    cout << "saved dom in " << timer << endl;
    return rc;
    // TODO: On truncation, retry with increasingly larger heap buffer
    // and re-attempt serialization.
    static std::string save_dom_to_string(
    xmlctx* xctx, xmlnode* root,
    bool add_xmldecl = true,
    ub4 indent_step = 2,
    ub4 indent_level = 0,
    bool prune_children = false,
    const char* eol = "\n"
    xmlerr err = XMLERR_OK;
    const ub4 max_len = 2048;
    oratext doc_string[max_len] = {0};
    boolean xmldecl = add_xmldecl? TRUE: FALSE;
    boolean prune = prune_children? TRUE: FALSE;
    const ubig_ora byte_count = myXmlSaveDom(
    xctx, &err, root,
    "buffer", doc_string,
    "buffer_length", max_len,
    "xmldecl", xmldecl, // ignored
    "prune", prune,
    // Using UTF-16 yields an empty string.
    // Using AL32UTF8 adds XML decl previously missing (with encoding="UTF-8")
    // despite requesting no xmldecl explicitly (was ignored anyway...), but
    // only if passing the doc node, not the root node.
    "output_encoding", "AL32UTF8",
    //"eol", eol, // LPX-00019: property "eol" unknown
    "indent_step", indent_step,
    "indent_level", indent_level, // ignored
    NULL // sentinel marking end of key/value pairs
    // Number of bytes written not returned, as advertised.
    // So deduce silent truncation from the end of the string
    // (nor is err set to XMLERR_SAVE_OVERFLOW...)
    const bool was_truncated = doc_string[max_len - 1] == '\0'
    && doc_string[max_len - 2] != '\0';
    const size_t actual_len = strlen((const char*)doc_string);
    cout << "byte_count return = " << byte_count
    << "; actual length = " << actual_len
    << "; truncated = " << (was_truncated? "true": "false")
    << endl;
    if (err == XMLERR_OK && actual_len > 0) {
    if (was_truncated) {
    cerr << "Truncation during XML serialization to a string" << endl;
    return std::string((const char*)doc_string, actual_len);
    return std::string();
    static void xml_dom_basics_main(int argc, const char* argv[]) {
    SystemTimer* disconnect_timer; // time "shutdown"
    Environment env(OCI_OBJECT);
    env.connect(zusername, zpassword, zdatabase);
    SystemTimer timer; // don't time connecting to DB
    OCIError*const errhp = env.errhp;
    xmlctx*const xctx = OCIXmlDbInitXmlCtx(
    env.envhp, env.svchp, errhp,
    (ocixmldbparam *)0, 0
    if (!xctx) {
    checkerr(OCI_ERROR, errhp);
    // TODO: Manipulate XML context???
    // FIXME: Instant Client SDK does not ship with xml.h...
    // Following call compiles (because include xmlotn.h) but doesn't link
    // with Instant Client SDK, because oci.dll doesn't export this symbol.
    //const boolean is_unicode = XmlIsUnicode(xctx);
    ** Same issue here, XmlLoadDom not available from oci.dll...
    // Parse "dummy" document
    xmlerr err = XMLERR_OK;
    oratext doc_string[] = "<dummy/>";
    xmldocnode* doc = XmlLoadDom(
    xctx, &err,
    "buffer", doc_string,
    "buffer_length", sizeof(doc_string)-1,
    "validate", TRUE,
    NULL // sentinel indicating last key/value pair
    if (!doc) {
    cerr << "XML parsing failed: rc = " << err << endl;
    // Only calls which are defined in xmlproc.h (in xdb/include) as
    // #define XmlXYZ which take an xctx as first param, and cast back
    // xctx into xmlctxhead, then access the struct of function pointers,
    // are accessible to a pure OCI / Instance Client app.
    oratext* dummy_root = 0;//[] = "dummy";
    oratext* dummy_uri = 0;
    xmldtdnode* dummy_dtd = 0;
    xmlerr err = XMLERR_OK;
    xmldocnode* doc = XmlCreateDocument(
    xctx, dummy_uri, dummy_root, dummy_dtd, &err
    if (!doc) {
    cerr << "XML parsing failed: rc = " << err << endl;
    } else {
    oratext root_tag[] = "root";
    xmlelemnode* root = XmlDomCreateElem(xctx, doc, root_tag);
    XmlDomAppendChild(xctx, doc, root);
    oratext child_tag[] = "child";
    xmlelemnode* child = XmlDomCreateElem(xctx, doc, child_tag);
    XmlDomAppendChild(xctx, root, child);
    xmltextnode* text = XmlDomCreateText(xctx, doc, (oratext*)"foo");
    XmlDomAppendChild(xctx, child, text);
    // Add a second child, but without text
    child = XmlDomCreateElem(xctx, doc, child_tag);
    XmlDomAppendChild(xctx, root, child);
    xmlelemnode* root2 = XmlDomGetDocElem(xctx, doc);
    assert(root == root2);
    xmlnodelist* children = XmlDomGetElemsByTag(
    xctx, root, (oratext*)"child"
    ub4 child_count = XmlDomGetNodeListLength(xctx, children);
    if (child_count > 0) {
    xmlnode* child0 = XmlDomGetNodeListItem(xctx, children, 0);
    if (XmlDomHasChildNodes(xctx, child0)) {
    // I assume it's text
    xmlnode* text0 = XmlDomGetFirstChild(xctx, child0);
    const oratext* value = XmlDomGetNodeValue(xctx, text0);
    ub4 value2_length = 0;
    const oratext* value2 = XmlDomGetNodeValueLen(xctx, text0, 0, 0, &value2_length);
    cout << "value = " << value << "; #value2 = " << value2_length << endl;
    XmlDomFreeNodeList(xctx, children);
    oratext doc_string[2048];
    const ubig_ora byte_count =
    (*XML_CB(xctx)->XML_SAVE_DOM_VA_CB)(
    //XmlSaveDomVA(
    xctx, &err, root,
    "buffer", doc_string,
    "buffer_length", 2048,//sizeof(doc_string) - 1,
    NULL
    cout << "byte_count = " << byte_count << endl;
    if (err == XMLERR_OK && byte_count > 0) {
    doc_string[sizeof(doc_string) - 1] = '\0'; // just in case
    cout << "doc = \n" << doc_string << endl;
    const std::string root_string = save_dom_to_string(xctx, root);
    cout << "root = \n" << root_string << endl;
    const std::string doc_string = save_dom_to_string(xctx, doc, false, 2, 2, false, "\r\n");
    cout << "doc = \n" << doc_string << endl;
    xmldocnode* doc2 = load_dom_from_string(
    xctx, doc_string.c_str(), (ub4)doc_string.size()
    const std::string doc_string2 = save_dom_to_string(xctx, doc2);
    cout << "doc2 = \n" << doc_string2 << endl;
    XmlFreeDocument(xctx, doc);
    XmlFreeDocument(xctx, doc2);
    // Try accessing freed doc on purpose (Hmmm, works...)
    //const std::string doc_string3 = save_dom_to_string(xctx, doc2);
    //cout << "doc3 = \n" << doc_string3 << endl;
    // 28 KB file. If file doesn't exist, simply prints out an error
    cout << "\n\n===== Loading / parsing 28 KB XML file =====" << endl;
    xmldocnode* xsd = load_dom_from_file(xctx, "georaster.xsd");
    cout << "XSD = \n" << save_dom_to_string(xctx, xsd, false, 2, 2, true, "\r\n");
    XmlFreeDocument(xctx, xsd);
    // 1,870 KB
    cout << "\n\n===== Loading / parsing 1,870 KB XML file =====" << endl;
    xmldocnode* witsml1 = load_dom_from_file(
    xctx, "medium.xml"
    cout << "WITSML1 = \n" << save_dom_to_string(xctx, witsml1, false, 2, 2, true);
    XmlFreeDocument(xctx, witsml1);
    // 68,911 KB
    cout << "\n\n===== Loading / parsing 68,911 KB XML file =====" << endl;
    xmldocnode* witsml2 = load_dom_from_file(
    xctx, "big.xml"
    cout << "WITSML2 = \n" << save_dom_to_string(xctx, witsml2, false, 2, 2, true);
    XmlFreeDocument(xctx, witsml2);
    OCIXmlDbFreeXmlCtx(xctx);
    cout << "xml_dom_basics_main: " << timer << endl;
    // For some reason, disconnecting after reading a large XML file
    // is very slow... Loading the 68 MB file above, in about 8 seconds,
    // results in the shutdown to take around 28 seconds!!!
    disconnect_timer = new SystemTimer; // time "shutdown"
    cout << "\n\nDisconnecting from DB, terminating OCI environment... " << endl;
    cout << "'shutdown' time: " << *disconnect_timer << endl;
    delete disconnect_timer;
    template <class T> T* checkxml(T* node, xmlerr err) {
    xmlnode* xml_node = node;
    if (!xml_node) {
    throw std::runtime_error("null node");
    if (err != XMLERR_OK) {
    throw std::runtime_error("XML error code returned");
    return node;
    static void xml_dom_select_main(int argc, const char* argv[]) {
    const oratext charset[] = "AL32UTF8";
    Environment env(OCI_OBJECT, charset, charset);
    env.connect(zusername, zpassword, zdatabase);
    SystemTimer timer; // don't time connecting to DB
    OCIError*const errhp = env.errhp;
    xmlctx*const xctx = OCIXmlDbInitXmlCtx(
    env.envhp, env.svchp, errhp,
    (ocixmldbparam *)0, 0
    if (!xctx) {
    checkerr(OCI_ERROR, errhp);
    throw std::runtime_error("Cannot initialize XML context");
    // Allocate Statement Handle
    OCIStmt* selecthp = 0;
    checkerr(
    OCIHandleAlloc(
    (dvoid *) env.envhp, (dvoid **) &selecthp,
    OCI_HTYPE_STMT, 0, 0
    env.errhp
    // Prepare Statement
    const char *const sql = "SELECT id, doc FROM xml_tab";
    checkerr(
    OCIStmtPrepare(
    selecthp, env.errhp,
    (const OraText*)sql, (ub4) strlen(sql),
    (ub4) OCI_NTV_SYNTAX, (ub4) OCI_DEFAULT
    env.errhp
    // Defines
    ub4 id = 0;
    OCIDefine* define_id = 0;
    checkerr(
    OCIDefineByPos(
    selecthp, &define_id, env.errhp, 1, &id, sizeof(id), SQLT_UIN,
    (dvoid *) 0, (ub2 *) 0, (ub2 *) 0, OCI_DEFAULT
    env.errhp
    OCIDefine* define_doc = 0;
    checkerr(
    OCIDefineByPos(
    selecthp, &define_doc, env.errhp, 2, 0, sizeof(point_typ), SQLT_NTY,
    (dvoid *) 0, (ub2 *) 0, (ub2 *) 0, OCI_DEFAULT
    env.errhp
    OCIType* xmltype_tdo = 0;
    const oratext xmltype_name[] = "XMLTYPE";
    checkerr(
    OCITypeByName(
    env.envhp, env.errhp, env.svchp,
    0, 0, // schema name (default schema when 0)
    xmltype_name, (ub4)strlen((const char*)xmltype_name),
    0, 0, // version name (ignored)
    OCI_DURATION_SESSION,
    OCI_TYPEGET_ALL,
    &xmltype_tdo // connection (service specific)
    env.errhp
    xmldocnode* doc = 0;
    ub4 doc_size = 0;
    OCIInd* p_doc_ind = 0;
    ub4 doc_ind_size = 0;//(ub4)sizeof(point_ind);
    checkerr(
    OCIDefineObject(
    define_doc, env.errhp, xmltype_tdo,
    //(void**)&p_pt, &pt_size, (void**)&p_pt_ind, &pt_ind_size
    (void**)&doc, 0, (void**)&p_doc_ind, 0
    env.errhp
    // Execute (scalar) Select Statement
    checkerr(
    OCIStmtExecute(
    env.svchp, selecthp, env.errhp, (ub4) 0 /* specific to select... */, (ub4) 0,
    (CONST OCISnapshot *) NULL, (OCISnapshot *) NULL,
    OCI_DEFAULT
    env.errhp,
    OCI_NO_DATA // TODO: Test with a select that returns no rows,
    // and specifying 0 iters, to see if it returns
    // OCI_SUCCESS, or OCI_NO_DATA
    // TODO: Describe the select-list.
    // TODO: Fix this screwed up logic!
    sword fetch_rc = OCI_NO_DATA;
    size_t row_count = 0;
    do {
    checkerr(
    fetch_rc = OCIStmtFetch2(
    selecthp, env.errhp, (ub4)1,
    (ub2)OCI_FETCH_NEXT, (sb4)0, (ub4)OCI_DEFAULT
    env.errhp, OCI_NO_DATA
    if (fetch_rc != OCI_NO_DATA) {
    ++row_count;
    if (p_doc_ind && *p_doc_ind == OCI_IND_NULL) {
    cerr << "\nXML doc#" << id << " is NULL" << endl;
    continue;
    cout << "\nXML doc#" << id << ":\n" << save_dom_to_string(xctx, doc) << endl;
    while (fetch_rc != OCI_NO_DATA);
    if (doc != NULL) {
    // When last row contained no document (NULL in XMLTYPE column),
    // the doc pointer is somehow reset to 0, and OCIObjectFree complains
    // about it: OCI-21560: argument 3 is null, invalid, or out of range
    checkerr(
    OCIObjectFree(env.envhp, env.errhp, doc, 0),
    env.errhp
    // Necessary to free documents when selecting XMLTYPE,
    // sinced used OCIObjectFree above?
    //XmlFreeDocument(xctx, doc);
    // Free Statement Handle
    checkerr(
    OCIHandleFree(selecthp, OCI_HTYPE_STMT),
    env.errhp
    OCIXmlDbFreeXmlCtx(xctx);
    cout << "xml_dom_select_main: " << timer << endl;
    static void xml_dom_insert_main(int argc, const char* argv[]) {
    Environment env(OCI_OBJECT);
    env.connect(zusername, zpassword, zdatabase);
    SystemTimer timer; // don't time connecting to DB
    OCIError*const errhp = env.errhp;
    xmlctx*const xctx = OCIXmlDbInitXmlCtx(
    env.envhp, env.svchp, errhp,
    (ocixmldbparam *)0, 0
    if (!xctx) {
    checkerr(OCI_ERROR, errhp);
    throw std::runtime_error("Cannot initialize XML context");
    xmlerr err = XMLERR_OK;
    xmldocnode* doc = checkxml(XmlCreateDocument(xctx, 0, 0, 0, &err), err);
    xmlelemnode* root = checkxml(XmlDomCreateElem(xctx, doc, (oratext*)"root"), err);
    XmlDomAppendChild(xctx, doc, root);
    xmlattrnode* version = checkxml(XmlDomCreateAttr(xctx, doc, (oratext*)"version", (oratext*)"0.1"), err);
    XmlDomAppendChild(xctx, root, version);
    xmlelemnode* child = checkxml(XmlDomCreateElem(xctx, doc, (oratext*)"child"), err);
    XmlDomAppendChild(xctx, root, child);
    xmltextnode* text = checkxml(XmlDomCreateText(xctx, doc, (oratext*)"baz"), err);
    XmlDomAppendChild(xctx, child, text);
    // Add a second child, but without text
    child = checkxml(XmlDomCreateElem(xctx, doc, (oratext*)"child"), err);
    XmlDomAppendChild(xctx, root, child);
    xmlattrnode* empty = checkxml(XmlDomCreateAttr(xctx, doc, (oratext*)"empty", (oratext*)"true"), err);
    XmlDomAppendChild(xctx, child, empty);
    const std::string doc_string = save_dom_to_string(xctx, doc);
    cout << "doc = \n" << doc_string << endl;
    // Insert this document into the DB
    // Allocate Statement Handle
    OCIStmt* selecthp = 0;
    checkerr(
    OCIHandleAlloc(
    (dvoid *) env.envhp, (dvoid **) &selecthp,
    OCI_HTYPE_STMT, 0, 0
    env.errhp
    // Prepare Statement
    const char *const sql = "INSERT INTO xml_tab (id, doc) VALUES (:1, :2)";
    checkerr(
    OCIStmtPrepare(
    selecthp, env.errhp,
    (const OraText*)sql, (ub4) strlen(sql),
    (ub4) OCI_NTV_SYNTAX, (ub4) OCI_DEFAULT
    env.errhp
    // Binds
    ub4 id = 101;
    OCIBind* bind_id = 0;
    checkerr(
    OCIBindByPos(
    selecthp, &bind_id, env.errhp, 1, &id, sizeof(id), SQLT_UIN,
    (dvoid *) 0, (ub2 *) 0, (ub2 *) 0, (ub4) 0, (ub4 *) 0, OCI_DEFAULT
    env.errhp
    OCIBind* bind_doc = 0;
    checkerr(
    OCIBindByPos(
    selecthp, &bind_doc, env.errhp, 2, 0, sizeof(point_typ), SQLT_NTY,
    (dvoid *) 0, (ub2 *) 0, (ub2 *) 0, (ub4) 0, (ub4 *) 0, OCI_DEFAULT
    env.errhp
    OCIType* xmltype_tdo = 0;
    const oratext xmltype_name[] = "XMLTYPE";
    checkerr(
    OCITypeByName(
    env.envhp, env.errhp, env.svchp,
    0, 0, // schema name (default schema when 0)
    xmltype_name, (ub4)strlen((const char*)xmltype_name),
    0, 0, // version name (ignored)
    OCI_DURATION_SESSION,
    OCI_TYPEGET_ALL,
    &xmltype_tdo // connection (service specific)
    env.errhp
    //xmldocnode* doc = 0;
    ub4 doc_size = 0;
    OCIInd doc_ind = OCI_IND_NOTNULL;
    OCIInd* p_doc_ind = &doc_ind;
    ub4 doc_ind_size = 0;//(ub4)sizeof(point_ind);
    checkerr(
    OCIBindObject(
    bind_doc, env.errhp, xmltype_tdo,
    //(void**)&p_pt, &pt_size, (void**)&p_pt_ind, &pt_ind_size
    (void**)&doc, 0, (void**)&p_doc_ind, 0
    env.errhp
    // Execute (scalar) Select Statement
    checkerr(
    OCIStmtExecute(
    env.svchp, selecthp, env.errhp, (ub4) 1, (ub4) 0,
    (CONST OCISnapshot *) NULL, (OCISnapshot *) NULL,
    OCI_DEFAULT
    env.errhp,
    OCI_NO_DATA // TODO: Test with a select that returns no rows,
    // and specifying 0 iters, to see if it returns
    // OCI_SUCCESS, or OCI_NO_DATA
    // Commit transaction
    checkerr(
    OCITransCommit(env.svchp, env.errhp, 0),
    env.errhp
    XmlFreeDocument(xctx, doc);
    OCIXmlDbFreeXmlCtx(xctx);
    cout << "xml_dom_insert_main: " << timer << endl;
    </tt>

  • OCI-21500 when binding a collection

    Hello all:
    I've got a very strange behaviour when binding a collection. If I try to bind an empty collection, my program runs. BUT when I add one element to the collection, I've got a SIGSEGV and this message appears:
    -21500: internal error code, arguments: [kohrsc153], [], [], [], [], [], [], []
    Errors in file :
    OCI-21500: internal error code, arguments: [kohrsc153], [], [], [], [], [], [], []
    ----- Call Stack Trace -----
    Error: stisini(),13 - Can't open /oracle1/app/oracle/product/9.2.0.1.0/bin/oracleError: Stack Initialization Failure
    Error: ssdinit() failed 13
    calling call entry argument values in hex
    location type point (? means dubious value)
    ----- Argument/Register Address Dump -----
    ----- End of Call Stack Trace -----
    Any idea?

    This is my code:
    CREATE TYPE my_collection IS TABLE OF my_element;
    I'm trying to call to a PLSQL procedure:
    PROCEDURE get_collection(
    v_collection IN OUT my_collection
    Then, in the C program:
    sword code = OCI_SUCCESS;
    OCITable pList              = (OCITable )0;
    char *statement_sql      = "begin package.get_collection(:list); end;";
    code=OCITypeByName(
    envhp,
    errhp,
    svchp,
    (CONST text *)ORA_SCHEMA,
    (ub4)ORA_SCHEMA_LEN,
    (CONST text *)("MY_ELEMENT"),
    (ub4)strlen("MY_ELEMENT"),
    NULL,
    (ub4)0,
    OCI_DURATION_SESSION,
    OCI_TYPEGET_ALL,
    &(DataClass)
    code=OCITypeByName(
    envhp,
    errhp,
    svchp,
    (CONST text *)ORA_SCHEMA,
    (ub4)ORA_SCHEMA_LEN,
    (CONST text *)("MY_COLLECTION"),
    (ub4)strlen("MY_COLLECTION"),
    NULL,
    (ub4)0,
    OCI_DURATION_SESSION,
    OCI_TYPEGET_ALL,
    &(DataListClass)
    code = OCIObjectNew(
    envhp,
    errhp,
    svchp,
    OCI_TYPECODE_NAMEDCOLLECTION,
    (DataListClass),
    (dvoid *)0,
    OCI_DURATION_DEFAULT,
    TRUE,
    (dvoid **)&(pList)
    /* Add one element */
    code = OCIObjectNew(
    envhp,
    errhp,
    svchp,
    OCI_TYPECODE_OBJECT,
    (DataClass),
    (dvoid *)0,
    OCI_DURATION_DEFAULT,
    TRUE,
    (dvoid **)&(elemData)
    code = OCIStringAssignText(
    envhp,
    errhp,
    (text *)"Name1",
    (ub4)strlen("Name1"),
    &(elemData->dataName)
    code = OCICollAppend(
    envhp,
    errhp,
    (CONST dvoid *)&(elemData),
    (dvoid **)NULL,
    (OCIColl *)(pCollection)
    code = OCIStmtPrepare2((OCISvcCtx *)svchp,(OCIStmt **)&stmtp,
    (OCIError *)errhp, (unsigned char *)statement_sql, strlen(statement_sql),
    NULL,0,OCI_NTV_SYNTAX,OCI_DEFAULT);
    /* Bind */
    code = OCIBindByPos(
    stmtp,
    &bind,
    errhp,
    (ub4)1,
    (dvoid* *) NULL,
    (sb4) 0,
    SQLT_NTY,
    (dvoid *) 0, (ub2 *)0, (ub2 *)0,
    (ub4) 0, (ub4 *) 0, (ub4) OCI_DEFAULT);
    code = OCIBindObject(
         bind,
    errhp,
    DataListClass,
    (dvoid **) &pList,
    (ub4 *) 0,
    (dvoid **)0,
    (ub4 *) 0);
    /* Execute */
    code = OCIStmtExecute(svchp, stmtp, errhp, (ub4)1, (ub4)0,
    (CONST OCISnapshot *) NULL,(OCISnapshot *) NULL, OCI_DEFAULT);
    I'm trying to run this code in an Oracle 9i environment.
    Thanks in advance.

  • Varray Using OCI

    Hi,
    While sending Varray as an input parameter
    to an Oracle Stored Procedure, the following OCI calls
    are returning no error.
    OCITypeByName(),
    OCIObjectNew(),
    OCICollAppend(),
    OCIBindByPos(),
    OCIBindByObject()
    But OCIStmtExecute() hangs without giving any error.
    Can You PLEASE send me an example code
    for achieving the same.
    Also Could You suggest some books which deal with OCI function calls (with examples) in detail.
    CAN I EXPECT A REPLY from Mr.Ravikanth for this....Thanks for your previous reply
    Thanks & Regards,
    Alamelu
    null

    Hi Alamelu,
    I am sending some sample code snippets
    that show usage of collections.
    No, there are currently no books written on OCI. You can definitely look at some of the demo programs using OCI.
    static CONST text CONST_W_PTR selar = (text )
    "SELECT * from customer_va";
    static CONST text CONST_W_PTR insar = (text )
    "insert into customer_va (custno, names) values (:custno, :names)";
    static CONST text CONST_W_PTR modar = (text )
    "update customer_va set names=:names where custno=:custno";
    ** execute "selar" statement which select an array column from a table.
    void selectar(envhp, svchp, stmthp, stmthp1, errhp, recurse)
    OCIEnv *envhp;
    OCISvcCtx *svchp;
    OCIStmt *stmthp;
    OCIStmt *stmthp1;
    OCIError *errhp;
    boolean recurse;
    OCIType *names_ar_tdo;
    OCIDefine defn1p, defn2p;
    OCIColl names_ar = (OCIColl ) 0;
    sword custno =0;
    sword status;
    sb4 index;
    dvoid *elem;
    OCIString *names;
    OCIInd names_null = (OCIInd ) 0;
    boolean exist, eoc, boc;
    OCIIter itr = (OCIIter ) 0;
    OCIBind bnd1p, bnd2p;
    int amount;
    OCIInd ind = -1;
    OCIInd *indp = &ind;
    sb4 collsiz;
    DISCARD printf("\n******** Entering selectar *********\n");
    /* define the application request */
    checkerr(errhp, OCIStmtPrepare(stmthp, errhp, (text *) selar,
    (ub4) strlen((const char *) selar),
    (ub4) OCI_NTV_SYNTAX, (ub4) OCI_DEFAULT));
    /* bind the input variable */
    checkerr(errhp, OCIDefineByPos(stmthp, &defn1p, errhp, (ub4) 1, (dvoid *) &custno,
    (sb4) sizeof(sword), SQLT_INT, (dvoid *) 0, (ub2 *)0,
    (ub2 *)0, (ub4) OCI_DEFAULT));
    checkerr(errhp, OCIDefineByPos(stmthp, &defn2p, errhp, (ub4) 2, (dvoid *) 0,
    (sb4) 0, SQLT_NTY, (dvoid *) 0, (ub2 *)0,
    (ub2 *)0, (ub4) OCI_DEFAULT));
    checkerr(errhp, OCITypeByName(envhp, errhp, svchp, (const text *) "",
    (ub4) strlen((const char *) ""),
    (const text *) "VCHAR_TAB",
    (ub4) strlen((const char *) "VCHAR_TAB"),
    (CONST text *) 0, (ub4) 0,
    OCI_DURATION_SESSION, OCI_TYPEGET_HEADER,
    &names_ar_tdo));
    checkerr(errhp, OCIDefineObject(defn2p, errhp, names_ar_tdo, (dvoid **) &names_ar,
    (ub4 *) 0, (dvoid **) &indp, (ub4 *) 0));
    checkerr(errhp, OCIStmtExecute(svchp, stmthp, errhp, (ub4) 0, (ub4) 0, (OCISnapshot *)
    NULL, (OCISnapshot *) NULL, (ub4) OCI_DEFAULT));
    /* execute and fetch */
    DISCARD printf(" Execute and fetch.\n");
    while ((status = OCIStmtFetch(stmthp, errhp, (ub4) 1, (ub4) OCI_FETCH_NEXT,
    (ub4) OCI_DEFAULT)) == OCI_SUCCESS &#0124; &#0124;
    status == OCI_SUCCESS_WITH_INFO)
    /* print the customer number */
    DISCARD printf("\nThe customer number is : %d.\n", custno);
    if (*indp == -1)
    DISCARD printf("The varray is NULL.\n\n");
    continue;
    /* check how many elements in the typed table */
    checkerr(errhp, OCICollSize(envhp, errhp, (CONST OCIColl *) names_ar,
    &collsiz));
    DISCARD printf("---> There are %d elements in the varray.\n", collsiz);
    DISCARD printf("\n---> Dump the array from the top to the bottom.\n");
    checkerr(errhp, OCIIterCreate(envhp, errhp, names_ar, &itr));
    for(eoc = FALSE;!OCIIterNext(envhp, errhp, itr, (dvoid **) &elem,
    (dvoid **) &names_null, &eoc) && !eoc;)
    names = *(OCIString **) elem;
    DISCARD printf(" The names is %s\n", OCIStringPtr(envhp, names));
    DISCARD printf(" atomic null indicator is %d\n", *names_null);
    DISCARD printf("\n---> Dump the array from the bottom to the top.\n");
    checkerr(errhp, OCIIterGetCurrent(envhp, errhp, itr, (dvoid **) &elem,
    (dvoid **) &names_null));
    names = *(OCIString **) elem;
    DISCARD printf(" The names is %s\n", OCIStringPtr(envhp, names));
    DISCARD printf(" atomic null indicator is %d\n", *names_null);
    for(boc = FALSE;!OCIIterPrev(envhp, errhp, itr, (dvoid **) &elem,
    (dvoid **) &names_null, &boc) && !boc;)
    names = *(OCIString **) elem;
    DISCARD printf(" The names is %s\n", OCIStringPtr(envhp, names));
    DISCARD printf(" atomic null indicator is %d\n", *names_null);
    checkerr(errhp, OCI IterDelete(envhp, errhp, &itr));
    /* insert into the same table, then dump the info again */
    if (recurse)
    custno = custno * 10;
    checkerr(errhp, OCIStmtPrepare(stmthp1, errhp, (text *) insar,
    (ub4) strlen((const char *) insar),
    (ub4) OCI_NTV_SYNTAX, (ub4) OCI_DEFAULT));
    /* bind the input variable */
    checkerr(errhp, OCIBindByName(stmthp1, &bnd1p, errhp, (text *) ":custno",
    (sb4) -1, (dvoid *) &custno,
    (sb4) sizeof(sword), SQLT_INT,
    (dvoid *) 0, (ub2 *)0, (ub2 *)0, (ub4) 0, (ub4 *) 0,
    (ub4) OCI_DEFAULT));
    checkerr(errhp, OCIBindByName(stmthp1, &bnd2p, errhp, (text *) ":names",
    (sb4) -1, (dvoid *) 0,
    (sb4) 0, SQLT_NTY, (dvoid *) 0, (ub2 *)0, (ub2 *)0,
    (ub4) 0, (ub4 *) 0, (ub4) OCI_DEFAULT));
    /* if custno == 20, then insert null nested table */
    *indp = -1;
    checkerr(errhp, OCIBindObject(bnd2p, errhp, names_ar_tdo,
    (dvoid **) &names_ar,
    (ub4 *) 0, (custno == 20) ? (dvoid **) &indp :
    (dvoid **) 0, (ub4 *) 0));
    checkerr(errhp, OCIStmtExecute(svchp, stmthp1, errhp, (ub4) 1,
    (ub4) 0, (OCISnapshot *) NULL,
    (OCISnapshot *) NULL, (ub4) OCI_DEFAULT));
    checkerr(errhp, OCITransCommit(svchp, errhp, (ub4) 0));
    if ( status!= OCI_NO_DATA )
    checkerr(errhp, status);
    if (recurse)
    selectar(envhp, svchp, stmthp, stmthp1, errhp, FALSE);
    DISCARD printf("\n\n");
    ** execute "selar" statement which select an array column from a table,
    ** then execute "modar" to modify the array.
    void modifyar(envhp, svchp, stmthp, stmthp1, errhp, recurse)
    OCIEnv *envhp;
    OCISvcCtx *svchp;
    OCIStmt *stmthp;
    OCIStmt *stmthp1;
    OCIError *errhp;
    boolean recurse;
    OCIType *names_ar_tdo;
    OCIDefine defn1p, defn2p;
    OCIColl names_ar = (OCIColl ) 0;
    sword custno =0;
    sword status;
    sb4 index, counter = 0;
    OCIString *names;
    dvoid *elem;
    OCIInd names_null = (OCIInd ) 0;
    boolean exist, eoc, boc;
    OCIIter itr = (OCIIter ) 0;
    OCIBind bnd1p, bnd2p;
    int amount;
    OCIInd ind = -1;
    OCIInd *indp = &ind;
    sb4 collsiz;
    DISCARD printf("\n******** Entering modifyar *********\n");
    /* define the application request */
    checkerr(errhp, OCIStmtPrepare(stmthp, errhp, (text *) selar,
    (ub4) strlen((const char *) selar),
    (ub4) OCI_NTV_SYNTAX, (ub4) OCI_DEFAULT));
    /* bind the input variable */
    checkerr(errhp, OCIDefineByPos(stmthp, &defn1p, errhp, (ub4) 1, (dvoid *) &custno,
    (sb4) sizeof(sword), SQLT_INT, (dvoid *) 0, (ub2 *)0,
    (ub2 *)0, (ub4) OCI_DEFAULT));
    checkerr(errhp, OCIDefineByPos(stmthp, &defn2p, errhp, (ub4) 2, (dvoid *) 0,
    (sb4) 0, SQLT_NTY, (dvoid *) 0, (ub2 *)0,
    (ub2 *)0, (ub4) OCI_DEFAULT));
    checkerr(errhp, OCITypeByName(envhp, errhp, svchp, (const text *) "",
    (ub4) strlen((const char *) ""),
    (const text *) "VCHAR_TAB",
    (ub4) strlen((const char *) "VCHAR_TAB"),
    (CONST text *) 0, (ub4) 0,
    OCI_DURATION_SESSION, OCI_TYPEGET_HEADER,
    &names_ar_tdo));
    checkerr(errhp, OCIDefineObject(defn2p, errhp, names_ar_tdo, (dvoid **) &names_ar,
    (ub4 *) 0, (dvoid **) &indp, (ub4 *) 0));
    checkerr(errhp, OCIStmtExecute(svchp, stmthp, errhp, (ub4) 0, (ub4) 0, (OCISnapshot *)
    NULL, (OCISnapshot *) NULL, (ub4) OCI_DEFAULT));
    /* execute and fetch */
    DISCARD printf("\n Execute and fetch.\n");
    while ((status = OCIStmtFetch(stmthp, errhp, (ub4) 1, (ub4) OCI_FETCH_NEXT,
    (ub4) OCI_DEFAULT)) == OCI_SUCCESS &#0124; &#0124;
    status == OCI_SUCCESS_WITH_INFO)
    /* print the customer number */
    DISCARD printf("\nThe customer id is : %d.\n", custno);
    if (*indp == -1)
    DISCARD printf("The varray is NULL.\n\n");
    continue;
    /* check how many elements in the varray */
    checkerr(errhp, OCICollSize(envhp, errhp, (CONST OCIColl *) names_ar,
    &collsiz));
    DISCARD printf("---> There are %d elements in the varray.\n", collsiz);
    DISCARD printf("\n---> Dump the table from the top to the bottom.\n");
    checkerr(errhp, OCIIterCreate(envhp, errhp, names_ar, &itr));
    for(eoc = FALSE;!OCIIterNext(envhp, errhp, itr, (dvoid **) &elem,
    (d void **) &names_null, &eoc) && !eoc;)
    names = *(OCIString **) elem;
    DISCARD printf(" The names is %s\n", OCIStringPtr(envhp, names));
    DISCARD printf(" atomic null indicator is %d\n", *names_null);
    /* modify records */
    if (recurse)
    if (!counter)
    /* nullify the array */
    for(;!OCICollTrim(envhp, errhp, (sb4) 1, names_ar););
    else
    if (counter %2)
    /* trim one row at the end */
    checkerr(errhp, OCICollTrim(envhp, errhp, (sb4) 1, names_ar));
    else
    /* append one row to the end */
    checkerr(errhp, OCICollAppend(envhp, errhp, (CONST dvoid *) names,
    (CONST dvoid *) names_null, names_ar));
    counter ++;
    checkerr(errhp, OCIStmtPrepare(stmthp1, errhp, (text *) modar,
    (ub4) strlen((const char *) modar),
    (ub4) OCI_NTV_SYNTAX, (ub4) OCI_DEFAULT));
    /* bind the input variable */
    checkerr(errhp, OCIBindByName(stmthp1, &bnd1p, errhp, (text *) ":custno",
    (sb4) -1, (dvoid *) &custno,
    (sb4) sizeof(sword), SQLT_INT,
    (dvoid *) 0, (ub2 *)0, (ub2 *)0, (ub4) 0, (ub4 *) 0,
    (ub4) OCI_DEFAULT));
    checkerr(errhp, OCIBindByName(stmthp1, &bnd2p, errhp, (text *) ":names",
    (sb4) -1, (dvoid *) 0,
    (sb4) 0, SQLT_NTY, (dvoid *) 0, (ub2 *)0, (ub2 *)0,
    (ub4) 0, (ub4 *) 0, (ub4) OCI_DEFAULT));
    /* try modify the varray into NULL if custno == 30 */
    if (custno == 30)
    *indp = -1;
    checkerr(errhp, OCIBindObject(bnd2p, errhp, names_ar_tdo,
    (dvoid **) &names_ar, (ub4 *) 0,
    (dvoid **) &indp, (ub4 *) 0));
    checkerr(errhp, OCIStmtExecute(svchp, stmthp1, errhp, (ub4) 1,
    (ub4) 0, (OCISnapshot *) NULL,
    (OCISnapshot *) NULL, (ub4) OCI_DEFAULT));
    checkerr(errhp, OCITransCommit(svchp, errhp, (ub4) 0));
    if ( status!= OCI_NO_DATA )
    checkerr(errhp, status);
    if (recurse)
    modifyar(envhp, svchp, stmthp, stmthp1, errhp, FALSE);
    DISCARD printf("\n\n");
    null

Maybe you are looking for

  • Problem with installing power manager

    Hello, I've been trying to install power manager 6.36 without success. The first setup which installs files into "c:\swtools\readyapps\pwrmgrv" goes well. but when im trying to install Power Manager and click next to install to the destination folder

  • How to place InDesign files inside InDesign files w/bleed intact?

    I'm placing InDesign working files inside another InDesign document that's a printer-provided template. Esentially, I've designed a multipage book and now need to put those pages with bleed into a larger, one page printer template. No trouble placing

  • Controlling Totals in Report Calcs

    I am using Hyperion Intelligence Explorer v8.5 but have had the same question with earlier versions. In pivots, calculated columns sometimes calculate on totals, and sometimes totals summ the calculated line. For example, if column C is the ratio of

  • Summit_rewritten_11g_oct_2008.zip : using 11.1.1.0.0 or 11.1.1.0.1

    hi Please consider the application in summit_rewritten_11g_oct_2008.zip, described in redeveloping_forms_in_adf_11g.pdf, titled "Case Study: Redeveloping an Oracle Forms application using Oracle JDeveloper 11g and Oracle ADF 11g" see http://www.oracl

  • Having problems logging into the apple apps

    hi i have got an iphone 4 and i am trying to log in to buy some games i am putting my id and my password but it keeps saying the password is wrong.  i have resetted my password several times but still wont allow me to log in.  can anyone help me with