Problem declaring and using a REF CURSOR

I'm having a real problem using a REF CURSOR type
Here's the DECLARE and the start of the BEGIN I've so far developed.
DECLARE
TYPE r1 IS RECORD (
szvcapc_pidm szvcapc.szvcapc_pidm%TYPE,
szvcapc_term_code szvcapc.szvcapc_term_code%TYPE,
szvcapc_request_no szvcapc.szvcapc_request_no%TYPE);
szvcapc_rec r1;
TYPE cursor_1 IS REF CURSOR RETURN r1;
szvcapc_cv cursor_1;
TYPE r2 IS RECORD (
stvests_code stvests.stvests_code%TYPE
stvests_rec r2;
TYPE cursor_2 IS REF CURSOR RETURN stvests_rec;
stvests_cv cursor_2;
BEGIN
OPEN szvcapc_cv FOR
SELECT szvcapc_pidm, szvcapc_term_code, szvcapc_request_no
FROM szvcapc
WHERE szvcapc_passed_ind = 'Y'
AND szvcapc_award_credits = 'N';
LOOP
FETCH szvcapc_cv INTO szvcapc_rec;
EXIT WHEN szvcapc_cv%NOTFOUND;
END LOOP;
OPEN stvests_cv FOR
SELECT stvests_code
FROM stvests
WHERE stvests_eff_headcount = 'Y';
LOOP
FETCH stvests_cv INTO stvests_rec;
EXIT WHEN stvests_cv%NOTFOUND;
END LOOP;
SELECT *
FROM (
<snip>
INNER JOIN stvests_rec
ON SFBETRM.SFBETRM_ESTS_CODE = stvests_rec.STVESTS_CODE
<snip>
I later try to use the stvests_rec and szvcapc_rec in the main SELECT statement it doesn't recognise stvests_rec and szvcapc_rec as a "Table or View".
I have to use a REF CURSOR as this code is ultimately for use in Oracle Reports.
What am I doing wrong?

> The reason I'm trying to use a REF CURSOR is that I was told that you
couldn't use CURSORs in Oracle Reports.
That does not change anything ito what happens on the Oracle server side. A cursor is a cursor is a cursor.
Every single SQL winds up as a cursor. Each cursor has a reference handle to access and use. HOW this handle is used in the language differs. But that is a language issue and not an Oracle RDBMS issue.
For example. An EXECUTE IMMEDIATE in PL/SQL creates a cursor handle and destroys it after use - automatically. An implicit cursor works the same. An explicit cursor you have the handle fetch from it and close from it when done.
A ref cursor is simply a handle that can be returned to an external client - allowing that application to use the handle to fetch the rows.
Do not think that a ref cursor is any different from the RDBMS side than any other cursor. The RDBMS does not know the difference. Does not care and nor should it.
> I'm trying to reduce the hits on the database from nested selects by
removing the dataset from the main SELECT statement and performing it only
once outside and then referencing this previously collected dataset inside the
main SELECT statement.
Good stuff that you are considering SQL performance. But you need to make sure that you
a) identify the performance inhibitor issue correctly
b) address this issue correctly
And you need to do that within SQL. Not PL/SQL. PL/SQL will always be slower at crunching data than SQL. For example, wanting to cache the data somehow to reduce the read overhead - that is exactly what the DB buffer cache does. It caches data. That is also exactly what the CBO will attempt - reduce the amount of data that needs to be read and processed.
Not saying that the RDBMS can do it all. It needs help from you - in the form of a SQL that instructs it to process only the minimum amount of data required to get the required results. In the form of a sound physical design that provides optimal usage of data storage and access (like indexing, partitioning, clustering, etc).
Bottom line - you cannot use a REF CURSOR to make a SQL go faster. A REF CURSOR is simply a cursor in the SQL Engine. A cursor is nothing but the "compiled-and-executable" code of a SQL "source program".

Similar Messages

  • Help on CAST function, defining TYPE TABLE and using a REF cursor

    Hi,
    I have written a procedure (lookup) inside a package (lookup_pkg) as shown below.
    Procedure has an output variable of type PL/SQL TABLE which is defined in the package.
    I want to write a wrapper procedure lookupref to the procedure lookup to return a ref cursor.
    CREATE OR REPLACE PACKAGE lookup_pkg AS
    TYPE t_lookup_refcur IS REF CURSOR;
    CURSOR c_lookup IS
         Select columns1,2,3,....100
                   FROM A, B, C, D, E
                   WHERE ROWNUM < 1;
    TYPE t_lookup IS TABLE OF c_lookup%ROWTYPE;
    Procedure lookup(id Number, o_lookup OUT t_lookup);
    End lookup_pkg;
    CREATE OR REPLACE PACKAGE BODY lookup_pkg As
    Procedure lookup(id Number, o_lookup OUT t_lookup) IS
    BEGIN
    END lookup;
    Procedure lookupref(id Number, o_lookupref OUT t_lookup_refcur) IS
    o_lookup t_lookup;
    BEGIN
    lookup(id, o_lookup t_lookup);
    OPEN t_lookup_refcur FOR
    SELECT *
         FROM TABLE(CAST(o_lookup AS t_lookup));
    Exception
    End lookupref;
    END lookup_pkg;
    When I compile this procedure, I am getting invalid datatype Oracle error and
    cursor points the datatype t_lookup in the CAST function.
    1. Can anyone tell me what is wrong in this. Can I convert a PL/SQL collection (pl/sql table in this case) to PL/SQL datatype table or does it need to be a SQL datatype only (which is created as a type in database).
    Also, to resolve this error, I have created a SQL type and table type instead of PL/SQL table in the package as shown below.
    create or replace type t_lookuprec as object
                   (Select columns1,2,3,....100
                   FROM A, B, C, D, E
                   WHERE ROWNUM < 1);
    create or replace type t_lookup_tab AS table of t_lookuprec;
    CREATE OR REPLACE PACKAGE BODY lookup_pkg As
    Procedure lookup(id Number, o_lookup OUT t_lookup) IS
    BEGIN
    END lookup;
    Procedure lookupref(id Number, o_lookupref OUT t_lookup_refcur) IS
    o_lookup t_lookup;
    BEGIN
    lookup(id, o_lookup t_lookup);
    OPEN t_lookup_refcur FOR
    SELECT *
         FROM TABLE(CAST(o_lookup AS t_lookup_tab));
    Exception
    End lookupref;
    END lookup_pkg;
    When I compile this package, I am getting "PL/SQL: ORA-22800: invalid user-defined type" Oracle error and
    points the datatype t_lookup_tab in the CAST function.
    2. Can anyone tell me what is wrong. Can I create a type with a select statement and create a table type using type created earlier?
    I have checked the all_types view and found that
    value for Incomplete column for these two types are YES.
    3. What does that mean?
    Any suggestions and help is appreciated.
    Thanks
    Srinivas

    create or replace type t_lookuprec as object
    (Select columns1,2,3,....100
    FROM A, B, C, D, E
    WHERE ROWNUM < 1);You are correct that you need to use CREATE TYPE to use the type in SQL.
    However unless I am mistaken you appear to have invented your own syntax for CREATE TYPE, suggest you refer to Oracle documentation.

  • Using a ref cursor

    I have a function that I created and am trying to use it to output data using a ref cursor. My function call is
    declare
    ret_cursor crsiweb.types.cursorType;
    type output_rec_type is record(
    location varchar2(100),
    client varchar2(100),
    number_in long,
    number_out long,
    total_cost varchar2(100),
    total_charge varchar2(100),
    net varchar2(100),
    average varchar2(100)
    output output_rec_type;
    begin
    ret_cursor := all_db.net_profit.net_profit(to_date(:P1_Date_Chart,'DD-Mon-RR'));
    fetch ret_cursor into output;
    dbms_output.put_line('Location' || ',' || 'Company'|| ',' || 'In' ||
    ','|| 'Out'|| ',' || 'Cost'|| ',' || 'Charge'
    || ',' || 'Net' || ',' || '30 Day Average');
    while ret_cursor%FOUND loop
    dbms_output.put_line(output.location || ',' || output.client || ',' || output.number_in ||
    ','|| output.number_out || ',' || output.total_cost || ',' || output.total_charge
    || ',' || output.net || ',' || output.average);
    fetch ret_cursor into output;
    end loop;
    close ret_cursor;
    end;
    i have it as a PL/SQL Procedure (anonymous block) in a region. When executed I get the following error:
    "ORA-06550: line 15, column 25: PLS-00904: insufficient privilege to access object ALL_DB.NET_PROFIT ORA-06550: line 15, column 4: PL/SQL: Statement ignored"
    The function is as follows: ( I created the function in OEM)
    create or replace procedure all_db.net_profit.net_profit
    as
    function net_profit(sdate IN date) return crsiweb.types.cursortype as
    ret_cursor crsiweb.types.cursortype;
    begin
    open ret_cursor for select 'a_chase' "Location",a."Client" "Client", sum(nvl(b."In",0)) "In", sum(nvl(a."Out",0)) "Out", to_char(sum(nvl(a."Cost",0)
    + nvl(b."Cost",0)),'FM$9999999990.00PR') "Cost",
    to_char(sum(nvl(a."Charge",0) + nvl(b."Charge",0)),'FM$9999999990.00PR') "Charge", to_char(sum(nvl(a."Net",0)
    + nvl(b."Net",0)),'FM$9999999990.00PR') "Net",
    to_char(sum(nvl("Average",0)),'FM$9999999990.00PR') "30 Day Average"
    -- Get Out, Cost, Net by date_out
    from (select client_name "Client", count(date_sent) "Out",
    round(sum(nvl(product_cost,0) + nvl(acost1,0) + nvl(acost2,0) + nvl(acost3,0) +
    nvl(acost4,0) + nvl(acost5,0) + nvl(acost6,0) + nvl(acost7,0)
    + nvl(acost8,0) + nvl(acost9,0) + nvl(acost10,0)),2)"Cost",
    round(sum(nvl(product_fee,0) + nvl(copy_fee,0) + nvl(afee1,0) + nvl(afee2,0)+ nvl(afee3,0)
    + nvl(afee4,0)+ nvl(afee5,0)+ nvl(afee6,0)+ nvl(afee7,0)+ nvl(afee1,8)+ nvl(afee1,9)
    + nvl(afee1,10)),2) "Charge",
    round(sum((nvl(product_fee,0) + nvl(copy_fee,0) + nvl(afee1,0) + nvl(afee2,0)+ nvl(afee3,0)
    + nvl(afee4,0)+ nvl(afee5,0)+ nvl(afee6,0)+ nvl(afee7,0)+ nvl(afee1,8)+ nvl(afee1,9)
    + nvl(afee1,10)) - (nvl(product_cost,0) + nvl(acost1,0) + nvl(acost2,0) + nvl(acost3,0) +
    nvl(acost4,0) + nvl(acost5,0) + nvl(acost6,0) + nvl(acost7,0)
    + nvl(acost8,0) + nvl(acost9,0) + nvl(acost10,0))),2) "Net"
    from a_chase.jim a
    inner join a_chase.clients b
    on a.clientid = b.clientid
    where trunc(date_sent) = trunc(sdate)
    group by client_name) a
    --Get In, Cost, Net by date_In
    left outer join (select client_name "Client", count(date_in) "In",
    round(sum(nvl(product_cost,0) + nvl(acost1,0) + nvl(acost2,0) + nvl(acost3,0) +
    nvl(acost4,0) + nvl(acost5,0) + nvl(acost6,0) + nvl(acost7,0)
    + nvl(acost8,0) + nvl(acost9,0) + nvl(acost10,0)),2)"Cost",
    round(sum(nvl(product_fee,0) + nvl(copy_fee,0) + nvl(afee1,0) + nvl(afee2,0)+ nvl(afee3,0)
    + nvl(afee4,0)+ nvl(afee5,0)+ nvl(afee6,0)+ nvl(afee7,0)+ nvl(afee1,8)+ nvl(afee1,9)
    + nvl(afee1,10)),2) "Charge",
    round(sum((nvl(product_fee,0) + nvl(copy_fee,0) + nvl(afee1,0) + nvl(afee2,0)+ nvl(afee3,0)
    + nvl(afee4,0)+ nvl(afee5,0)+ nvl(afee6,0)+ nvl(afee7,0)+ nvl(afee1,8)+ nvl(afee1,9)
    + nvl(afee1,10)) - (nvl(product_cost,0) + nvl(acost1,0) + nvl(acost2,0) + nvl(acost3,0) +
    nvl(acost4,0) + nvl(acost5,0) + nvl(acost6,0) + nvl(acost7,0)
    + nvl(acost8,0) + nvl(acost9,0) + nvl(acost10,0))),2) "Net"
    from a_chase.jim a
    inner join a_chase.clients b
    on a.clientid = b.clientid
    where trunc(date_in) = trunc(sdate)
    group by client_name) b
    on a."Client" = b."Client"
    -- Get 30 Day Average
    inner join (select client_name, round(avg("Net"),2) "Average" from
    (select trunc(date_in) "In", client_name, round(sum((nvl(product_fee,0) + nvl(copy_fee,0) + nvl(afee1,0) + nvl(afee2,0)+ nvl(afee3,0)
    + nvl(afee4,0)+ nvl(afee5,0)+ nvl(afee6,0)+ nvl(afee7,0)+ nvl(afee1,8)+ nvl(afee1,9)
    + nvl(afee1,10)) - (nvl(product_cost,0) + nvl(acost1,0) + nvl(acost2,0) + nvl(acost3,0) +
    nvl(acost4,0) + nvl(acost5,0) + nvl(acost6,0) + nvl(acost7,0)
    + nvl(acost8,0) + nvl(acost9,0) + nvl(acost10,0))),2) "Net"
    from a_chase.jim a
    inner join a_chase.clients b
    on a.clientid = b.clientid
    where trunc(date_in) between (trunc(sdate) - 30) and trunc(sdate)
    group by trunc(date_in), client_name)
    group by client_name) c
    on a."Client" = c.client_name
    group by a."Client"
    union --BU_TS
    select 'bu_ts' "Location",a."Client" "Client", sum(nvl(b."In",0)) "In", sum(nvl(a."Out",0)) "Out", to_char(sum(nvl(a."Cost",0)
    + nvl(b."Cost",0)),'FM$9999999990.00PR') "Cost",
    to_char(sum(nvl(a."Charge",0) + nvl(b."Charge",0)),'FM$9999999990.00PR') "Charge", to_char(sum(nvl(a."Net",0)
    + nvl(b."Net",0)),'FM$9999999990.00PR') "Net",
    to_char(sum(nvl("Average",0)),'FM$9999999990.00PR') "30 Day Average"
    -- Get Out, Cost, Net by date_out
    from (select client_name "Client", count(date_sent) "Out",
    round(sum(nvl(product_cost,0) + nvl(acost1,0) + nvl(acost2,0) + nvl(acost3,0) +
    nvl(acost4,0) + nvl(acost5,0) + nvl(acost6,0) + nvl(acost7,0)
    + nvl(acost8,0) + nvl(acost9,0) + nvl(acost10,0)),2)"Cost",
    round(sum(nvl(product_fee,0) + nvl(copy_fee,0) + nvl(afee1,0) + nvl(afee2,0)+ nvl(afee3,0)
    + nvl(afee4,0)+ nvl(afee5,0)+ nvl(afee6,0)+ nvl(afee7,0)+ nvl(afee1,8)+ nvl(afee1,9)
    + nvl(afee1,10)),2) "Charge",
    round(sum((nvl(product_fee,0) + nvl(copy_fee,0) + nvl(afee1,0) + nvl(afee2,0)+ nvl(afee3,0)
    + nvl(afee4,0)+ nvl(afee5,0)+ nvl(afee6,0)+ nvl(afee7,0)+ nvl(afee1,8)+ nvl(afee1,9)
    + nvl(afee1,10)) - (nvl(product_cost,0) + nvl(acost1,0) + nvl(acost2,0) + nvl(acost3,0) +
    nvl(acost4,0) + nvl(acost5,0) + nvl(acost6,0) + nvl(acost7,0)
    + nvl(acost8,0) + nvl(acost9,0) + nvl(acost10,0))),2) "Net"
    from bu_ts.jim a
    inner join bu_ts.clients b
    on a.clientid = b.clientid
    where trunc(date_sent) = trunc(sdate)
    group by client_name) a
    --Get In, Cost, Net by date_In
    left outer join (select client_name "Client", count(date_in) "In",
    round(sum(nvl(product_cost,0) + nvl(acost1,0) + nvl(acost2,0) + nvl(acost3,0) +
    nvl(acost4,0) + nvl(acost5,0) + nvl(acost6,0) + nvl(acost7,0)
    + nvl(acost8,0) + nvl(acost9,0) + nvl(acost10,0)),2)"Cost",
    round(sum(nvl(product_fee,0) + nvl(copy_fee,0) + nvl(afee1,0) + nvl(afee2,0)+ nvl(afee3,0)
    + nvl(afee4,0)+ nvl(afee5,0)+ nvl(afee6,0)+ nvl(afee7,0)+ nvl(afee1,8)+ nvl(afee1,9)
    + nvl(afee1,10)),2) "Charge",
    round(sum((nvl(product_fee,0) + nvl(copy_fee,0) + nvl(afee1,0) + nvl(afee2,0)+ nvl(afee3,0)
    + nvl(afee4,0)+ nvl(afee5,0)+ nvl(afee6,0)+ nvl(afee7,0)+ nvl(afee1,8)+ nvl(afee1,9)
    + nvl(afee1,10)) - (nvl(product_cost,0) + nvl(acost1,0) + nvl(acost2,0) + nvl(acost3,0) +
    nvl(acost4,0) + nvl(acost5,0) + nvl(acost6,0) + nvl(acost7,0)
    + nvl(acost8,0) + nvl(acost9,0) + nvl(acost10,0))),2) "Net"
    from bu_ts.jim a
    inner join bu_ts.clients b
    on a.clientid = b.clientid
    where trunc(date_in) = trunc(sdate)
    group by client_name) b
    on a."Client" = b."Client"
    -- Get 30 Day Average
    inner join (select client_name, round(avg("Net"),2) "Average" from
    (select trunc(date_in) "In", client_name, round(sum((nvl(product_fee,0) + nvl(copy_fee,0) + nvl(afee1,0) + nvl(afee2,0)+ nvl(afee3,0)
    + nvl(afee4,0)+ nvl(afee5,0)+ nvl(afee6,0)+ nvl(afee7,0)+ nvl(afee1,8)+ nvl(afee1,9)
    + nvl(afee1,10)) - (nvl(product_cost,0) + nvl(acost1,0) + nvl(acost2,0) + nvl(acost3,0) +
    nvl(acost4,0) + nvl(acost5,0) + nvl(acost6,0) + nvl(acost7,0)
    + nvl(acost8,0) + nvl(acost9,0) + nvl(acost10,0))),2) "Net"
    from bu_ts.jim a
    inner join bu_ts.clients b
    on a.clientid = b.clientid
    where trunc(date_in) between (trunc(sdate) - 30) and trunc(sdate)
    group by trunc(date_in), client_name)
    group by client_name) c
    on a."Client" = c.client_name
    group by a."Client"
    union --BU
    select 'BU' "Location", a."Company" "Client", sum(nvl(b."In",0)) "In", sum(nvl(a."Out",0)) "Out", to_char(sum(nvl(a."Cost",0)
    + nvl(b."Cost",0)),'FM$9999999990.00PR') "Cost",
    to_char(sum(nvl(a."Charge", 0) + nvl(b."Charge",0)),'FM$9999999990.00PR') "Charge", to_char(sum(nvl(a."Net",0)
    + nvl(b."Net",0)),'FM$9999999990.00PR') "Net",
    to_char(sum(nvl("Average",0)),'FM$9999999990.00PR') "30 Day Average"
    from
    (--Out Query
    select b.clcompanyname "Company", count(*) "Out",
    round(sum(nvl(cost1,0) + nvl(cost2,0) + nvl(cost3,0) + nvl(cost4,0) + nvl(cost5,0) + nvl(costx1,0)
    + nvl(costx2,0)+ nvl(costx3,0)+ nvl(costx4,0)+ nvl(costx5,0)+ nvl(costy1,0)+ nvl(costy2,0)+ nvl(costy3,0)
    + nvl(costy4,0)+ nvl(costy5,0)),2) "Cost",
    round(sum(nvl(fee1,0) + nvl(fee2,0) + nvl(fee3,0) + nvl(fee4,0) + nvl(fee5,0) + nvl(feex1,0)
    + nvl(feex2,0)+ nvl(feex3,0)+ nvl(feex4,0)+ nvl(feex5,0)+ nvl(feey1,0)+ nvl(feey2,0)+ nvl(feey3,0)
    + nvl(feey4,0)+ nvl(feey5,0)),2) "Charge",
    round( sum(nvl(fee1,0) + nvl(fee2,0) + nvl(fee3,0) + nvl(fee4,0) + nvl(fee5,0) + nvl(feex1,0)
    + nvl(feex2,0)+ nvl(feex3,0)+ nvl(feex4,0)+ nvl(feex5,0)+ nvl(feey1,0)+ nvl(feey2,0)+ nvl(feey3,0)
    + nvl(feey4,0)+ nvl(feey5,0) - nvl(cost1,0) - nvl(cost2,0) - nvl(cost3,0) - nvl(cost4,0) - nvl(cost5,0) - nvl(costx1,0)
    - nvl(costx2,0)- nvl(costx3,0)- nvl(costx4,0)- nvl(costx5,0)- nvl(costy1,0)- nvl(costy2,0)- nvl(costy3,0)
    - nvl(costy4,0)- nvl(costy5,0)),2) "Net"
    from [email protected] a
    inner join [email protected] b
    on a.clientid = b.clientid
    where trunc(compdate1) = trunc(sdate)
    or trunc(compdate2) = trunc(sdate)
    or trunc(compdate3) = trunc(sdate)
    or trunc(compdate4) = trunc(sdate)
    or trunc(compdate5) = trunc(sdate)
    group by b.clcompanyname) a
    --in Query
    left outer join (select b.clcompanyname "Company", count(a.loandatein) "In",
    round(sum(nvl(cost1,0) + nvl(cost2,0) + nvl(cost3,0) + nvl(cost4,0) + nvl(cost5,0) + nvl(costx1,0)
    + nvl(costx2,0)+ nvl(costx3,0)+ nvl(costx4,0)+ nvl(costx5,0)+ nvl(costy1,0)+ nvl(costy2,0)+ nvl(costy3,0)
    + nvl(costy4,0)+ nvl(costy5,0)),2) "Cost",
    round(sum(nvl(fee1,0) + nvl(fee2,0) + nvl(fee3,0) + nvl(fee4,0) + nvl(fee5,0) + nvl(feex1,0)
    + nvl(feex2,0)+ nvl(feex3,0)+ nvl(feex4,0)+ nvl(feex5,0)+ nvl(feey1,0)+ nvl(feey2,0)+ nvl(feey3,0)
    + nvl(feey4,0)+ nvl(feey5,0)),2) "Charge",
    round( sum(nvl(fee1,0) + nvl(fee2,0) + nvl(fee3,0) + nvl(fee4,0) + nvl(fee5,0) + nvl(feex1,0)
    + nvl(feex2,0)+ nvl(feex3,0)+ nvl(feex4,0)+ nvl(feex5,0)+ nvl(feey1,0)+ nvl(feey2,0)+ nvl(feey3,0)
    + nvl(feey4,0)+ nvl(feey5,0) - nvl(cost1,0) - nvl(cost2,0) - nvl(cost3,0) - nvl(cost4,0) - nvl(cost5,0) - nvl(costx1,0)
    - nvl(costx2,0)- nvl(costx3,0)- nvl(costx4,0)- nvl(costx5,0)- nvl(costy1,0)- nvl(costy2,0)- nvl(costy3,0)
    - nvl(costy4,0)- nvl(costy5,0)),2) "Net"
    from [email protected] a
    inner join [email protected] b
    on a.clientid = b.clientid
    where trunc(a.loandatein) = trunc(sdate)
    group by b.clcompanyname) b
    on a."Company" = b."Company"
    --Avg Query
    inner join (select "Company", round(avg("Net"),2) "Average" from
    (select trunc(loandatein) "In", b.clcompanyname "Company",
    round( sum(nvl(fee1,0) + nvl(fee2,0) + nvl(fee3,0) + nvl(fee4,0) + nvl(fee5,0) + nvl(feex1,0)
    + nvl(feex2,0)+ nvl(feex3,0)+ nvl(feex4,0)+ nvl(feex5,0)+ nvl(feey1,0)+ nvl(feey2,0)+ nvl(feey3,0)
    + nvl(feey4,0)+ nvl(feey5,0) - nvl(cost1,0) - nvl(cost2,0) - nvl(cost3,0) - nvl(cost4,0) - nvl(cost5,0) - nvl(costx1,0)
    - nvl(costx2,0)- nvl(costx3,0)- nvl(costx4,0)- nvl(costx5,0)- nvl(costy1,0)- nvl(costy2,0)- nvl(costy3,0)
    - nvl(costy4,0)- nvl(costy5,0)),2) "Net"
    from [email protected] a
    inner join [email protected] b
    on a.clientid = b.clientid
    where trunc(loandatein) between (trunc(sdate) - 30) and trunc(sdate)
    group by trunc(loandatein), b.clcompanyname)
    group by "Company") c
    on a."Company" = c."Company"
    group by a."Company";
    return(ret_cursor);
    end;
    end;
    I also have given htmldb_public_user grant/execute privileges on this function. Any help would be greatly appreciated.
    Thanks,
    Scott

    thanks, lalit. that's almost correct. htmldb_public_user is the username through which the mod_plsql DAD connects to the database. he has just the privs he needs to serve that function. the htmldb engine compiles into a FLOWS_010500 schema in the production release. having said that, lalit's suggestion is correct. you need to make sure your htmldb application schema (identified by the application-level attribute "Default Parsing Schema") has been directly granted privileges (directly as opposed to coming through a role rant) to run the objects it's calling.
    hope this helps,
    raj

  • Use CLOB & Ref Cursor

    Hi,
    Can some one help.
    I am getting string more than 32767 char so I want to use CLOB but I am unable to use in ref Cursor.
    CREATE OR REPLACE PROCEDURE PM.PROC_CURSOR_BTDCS (P_QUERY IN varchar2, P_batchid out Number) AS
    P VARCHAR2(32767);
    P_CURSOR_QUERY SYS_REFCURSOR;
    X_JOBID varchar2(30);
    X_BATCHID VARCHAR2(1000);
    X_CREF VARCHAR2(10000);
    X_CLIENTREF VARCHAR2(10000);
    X_CLIENTID NUMBER;
    X_USERID NUMBER;
    X_RDATE varchar2(40);
    X_DDATE varchar2(40);
    X_STAGE NUMBER;
    X_DIFF NUMBER;
    X_CLIENTDUEDATE varchar2(40);
    X_ASSETID NUMBER;
    X_MODEID NUMBER;
    p_o_error VARCHAR2(100);
    p_o_status NUMBER;
    BEGIN
    P := 'SELECT DISTINCT JOBID,CLID,USERID,STAGE,
    GET_CSV_DATA(CURSOR (SELECT CREF FROM ('|| P_QUERY ||') WHERE jobid =A.JOBID AND CLID=A.CLID AND USERID=A.USERID AND RDATE=A.RDATE AND DDATE=A.DDATE AND STAGE=A.STAGE AND ASSETID=A.ASSETID AND CLDATE=A.CLDATE AND DIFF=A.DIFF)) C_CREF,
    GET_CSV_DATA(CURSOR (SELECT BATCHID FROM ('|| P_QUERY ||') WHERE jobid =A.JOBID AND CLID=A.CLID AND USERID=A.USERID AND RDATE=A.RDATE AND DDATE=A.DDATE AND STAGE=A.STAGE AND ASSETID=A.ASSETID AND CLDATE=A.CLDATE AND DIFF=A.DIFF)) C_BATCH,
    GET_CSV_DATA(CURSOR (SELECT Crefname FROM ('|| P_QUERY ||') WHERE jobid =A.JOBID AND CLID=A.CLID AND USERID=A.USERID AND RDATE=A.RDATE AND DDATE=A.DDATE AND STAGE=A.STAGE AND ASSETID=A.ASSETID AND CLDATE=A.CLDATE AND DIFF=A.DIFF)) C_CLIENTREF
    ,DIFF,cldate,ASSETID
    ,RDATE,DDATE,MODEID
    FROM('||P_QUERY||') A';
    --INSERT INTO FROG VALUES(P,sysdate);
    OPEN P_CURSOR_QUERY FOR P;
    LOOP
    FETCH P_CURSOR_QUERY INTO X_JOBID
    ,X_CLIENTID,X_USERID,X_STAGE,
    X_CREF,X_BATCHID,X_CLIENTREF,X_DIFF,
    X_CLIENTDUEDATE,
    X_assetid,X_RDATE,X_DDATE,X_MODEID;
    EXIT WHEN P_CURSOR_QUERY%NOTFOUND;
    -- INSERT INTO FROG VALUES (X_CREF);
    Proc_batchchangestage_upd (X_JOBID,X_BATCHID,X_CREF,X_CLIENTREF,X_userid,X_clientid,X_RDATE,
    X_DDATE,
    X_stage,
    X_CLIENTDUEDATE,
    X_diff,
    X_assetid,X_MODEID,p_batchid,
    p_o_error,
    p_o_status);
    END LOOP;
    CLOSE P_CURSOR_QUERY;
    COMMIT;
    END;

    It would be helpful to indicate the error you're getting and the line where you're getting the error.
    I will assume that your goal is to construct a SQL query > 32k, store that query in p, and open a cursor using p. In order to do that, you'd have to use the DBMS_SQL package, which is going to complicate your life rather significantly.
    That said, it's far from obvious to my why the SQL statement needs to exceed 32k. At a minimum, concatentaing P_QUERY three times would seem unnecessary. If the text of P_QUERY exceeds 10,000 characters, I would really tend to suspect that you've done something wrong there and would benefit from simplifying the query or at least using a couple views.
    Justin

  • What are the advantages to using a REF cursor

    When would I want to use a REF cursor?

    REF CURSORs are not cursors, they're references to cursors. This means they're dynamic. So you can completely change the query executed by the cursor.
    For example you can use a REF CURSOR to select from one of a number of tables (depending on an input parameter or other sort of flag). The results are fetched into the same resultset holder and hence you only need a single lot of code to process the results.
    Also you can also pass a REF CURSOR as a argument to other PL/SQL procedures and functions.
    rgds, APC

  • Best way to declare and use internal table

    Hi all,
    As per my knoledge there are various techeniques (Methods) to declare and use the internal tables.
    Please Suggest me the Best way to declaring and using internal table ( WITH EXAMPLE ).
    Please Give the reason as well how the particular method is good ?
    What are benefits of particular method ?
    Thanks in advance.
    Regards
    Raj

    Hello Raj Ahir,
    There are so many methods to declare an internal table.
    Mainly I would like to explain 2 of them mostly used.
    1. Using Work Area and
    2. With header line.
    This with header line concept is not suggestable, because, when we shift the code to oops concept.. it doesn't work... Because OOPS doesn't support the Headerline concept...
    But it all depends on the situation.
    If you are sure that your program doen't make use of the OOPs concept, you can use HEADER LINE concept. If it invols OOPs use WORK AREA concept.
    Now I'l explain these two methods with an example each...
    1. Using Work area.
    TABLES: sflight.
    DATA: it_sflight TYPE TABLE OF sflight.
    DATA: wa_sflight LIKE LINE OF it_sflight.
    SELECT *
      FROM sflight
      INTO it_sflight
      WHERE <condition>.
      LOOP AT it_sflight INTO wa_sflight.
        WRITE / wa_sflight.
      ENDLOOP.
      In this case we have to transfer data into work area wa_sflight.
    We can't access the data from the internal table direclty without work
    area.
    *<===============================================
    2. Using Header line.
      DATA: BEGIN OF it_sflight OCCURS 0,
              carrid LIKE sflight-carrid,
              connid LIKE sflight-connid,
              fldate LIKE sflight-fldate,
            END OF it_sflight.
      SELECT *
        FROM sflight
        INTO it_sflight
        WHERE <condition>.
        LOOP AT it_sflight INTO wa_sflight.
          WRITE / wa_sflight.
        ENDLOOP.
    In this case we can directly access the data from the internal table.
    Here the internal table name represents the header. for each and every
    interation the header line will get filled with new data. If you want to
    represnent the internal table body you can use it_sflight[].
    *<======================================================
    TYPES: BEGIN OF st_sflight,
             carrid LIKE sflight-carrid,
             connid LIKE sflight-connid,
             fldate LIKE sflight-fldate,
           END OF st_sflight.
    DATA: it_sflight TYPE TABLE OF st_sflight,
          wa_sflight LIKE LINE OF it_sflight.
    This is using with work area.
    DATA: it_sflight LIKE sflight OCCURS 0 WITH HEADER LINE.
    This is using header line.
    <b>REWARD THE POINTS IF IT IS HELPFUL.</b>
    Regards
    Sasidhar Reddy Matli.
    Message was edited by: Sasidhar Reddy Matli
            Sasidhar Reddy Matli

  • Performance problem with sproc and out parameter ref cursor

    Hi
    I have sproc with Ref Cursor as an OUT parameter.
    It is extremely slow looping over the ResultSet (does it record by record in the fetch).
    so I have added setPrefetchRowCount(100) and setPrefetchMemorySize(6000)
    pseudo code below:
    string sqlSmt = "BEGIN get_tick_data( :v1 , :v2); END;";
    Statement* s = connection->createStatement(sqlStmt);
    s->setString(1, i1);
    // cursor ( f1 , f2, f3 , f4 , i1 ) f for float type and i for interger value.
    // 5 columns as part of cursor with 4 columns are having float value and
    // 1 column is having int value assuming 40 bytes for one rec.
    s->setPrefetchRowCount (100);
    s->PrefetchMemorySize(6000);
    s->registerOutParam(2,OCCICURSOR);
    s->execute();
    ResultSet* rs = s->getCursor(2);
    while (rs->next()) {
    // do, and do v slowly!
    }

    Hi,
    I have the same problem. It seems, when retrieving cursor, that "setPrefetchRowCount" is not taking into account by OCCI. If you have a SQL statement like "SELECT STR1, STR2, STR3 FROM TABLE1" that works fine but if your SQL statement is a call to a stored procedure returning a cursor each row fetching need a roudtrip.
    To avoid this problem you need to use the method "setDataBuffer" from the object "ResultSet" for each column of your cursor. It's easy to use with INT type and STRING type, a lit bit more complex with DATE type. But until now, I'm not able to do the same thing with REF type.
    Below a sample with STRING TYPE (It's assuming that the cursor return only one column of STRING type):
    try
      l_Statement = m_Connection->createStatement("BEGIN :1 := PACKAGE1.GetCursor1(:2); END;");
      l_Statement->registerOutParam(1, oracle::occi::OCCINUMBER, sizeof(l_CodeErreur));
      l_Statement->registerOutParam(2, oracle::occi::OCCICURSOR);
      l_Statement->executeQuery();
      l_CodeErreur = l_Statement->getNumber(1);
      if ((int) l_CodeErreur     == 0)
        char                         l_ArrayName[5][256];
        ub2                          l_ArrayNameSize[5];
        l_ResultSet  = l_Statement->getCursor(2);
        l_ResultSet->setDataBuffer(1, l_ArrayName,   OCCI_SQLT_STR, sizeof(l_ArrayName[0]),   l_ArrayNameSize,   NULL, NULL);
        while (l_ResultSet->next(5))
          for (int i = 0; i < l_ResultSet->getNumArrayRows(); i++)
            l_Name = CString(l_ArrayName);
    l_Statement->closeResultSet(l_ResultSet);
    m_Connection->terminateStatement(l_Statement);
    catch (SQLException &p_SQLException)
    I hope that sample help you.
    Regards                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • MS Access, ODBC and SPs returning ref cursor

    I have some functions and procedures in a package returning ref cursors that work fine in my C++ batch applications. I would like for the GUI to be able to call these as well.
    Unfortunately, we are using Access as the front end (for now), and we have not been able to get the ref cursors to work. Is this supported? We are using Oracle 8.0.5 on Solaris, and our clients is Access 97 on NT using Intersolv's ODBC driver.
    My procedure looks something like:
    package jec is
    procedure open_sale_cur(
    p_client_id number,
    sale_curvar out sale_curtype)
    is begin
    open sale_curtype for select ... ;
    end;
    end;
    And the Access code looks like this:
    strSql = "begin jec.open_sale_cur(27, ?); end;"
    qdfTemp = conMain.CreateQueryDef("", strSql)
    qdfTemp.Parameters(0).Direction = dbParamOutput
    qdfTemp.Execute()
    This is the error when Execute() is called:
    PLS-00306: wrong number or types of arguments in call to 'OPEN_SALE_CUR'
    I am not an Access programmer; I am simply passing along this information. Any help would be greatly appreciated.

    We tried the {call...} syntax originally, but when we use it, we get an Oracle syntax error for the statement
    SELECT * FROM {call ...}
    Apparently Access prepends "SELECT..." before passing the SQL text to Oracle.
    This is also the case for procedures with normal scalars, such as numbers, returned as OUT values. When we use anon PL/SQL syntax and "?" placeholders with such procedures, they work. When we use {call ...} syntax or omit OUT placeholders, they do not.
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Justin Cave ([email protected]):
    I suspect that you want to simply execute the statement
    strSql = {call open_sale_cur( 27 )}
    The ODBC driver will automatically figure out that there's an output parameter which is a ref cursor and return that as the result set. Note that you may want to download the latest 8.0.5 ODBC driver (8.0.5.10 I believe) if there are any problems.
    Justin<HR></BLOCKQUOTE>
    null

  • Using Implicit REF Cursor in Oracle DB 12c

    For those interested in using ODP.NET implicit REF Cursors in Oracle DB 12c, the syntax is different from what was available in Oracle 11g. Here's a 12c-specific example:
    =======================
    Create or Replace PROCEDURE GetEmpAndDept
    AS
    EMPS  sys_refcursor;
    DEPTS  sys_refcursor;
    BEGIN
      OPEN EMPS for SELECT empno, ename from emp;
      dbms_sql.return_result(EMPS);
      OPEN DEPTS for SELECT deptno, dname from dept;
      dbms_sql.return_result(DEPTS);
    END;
    =======================
    // C#
    OracleConnection conn = new OracleConnection("User Id=scott; Password=tiger);
      conn.Open(); // Open the connection to the database
    // Create the command object for executing cmdTxt
      OracleCommand cmd = new OracleCommand("GetEmpAndDept", conn);
      cmd.CommandType = CommandType.StoredProcedure;
      OracleDataReader rdr = cmd.ExecuteReader();
      while(rdr.Read())
         Console.WriteLine("{0}\t{1}", rdr.GetInt32(0), rdr.GetString(1) );
      rdr.NextResult();
       while(rdr.Read())
           Console.WriteLine("{0}\t{1}", rdr.GetInt32(0), rdr.GetString(1) );

    i am using Oracle.ManagedDataAccess.dll v4.121.1.0
    Oracle Data Base 12c
    Visual Studio 2012 .net framework 4
    But if I use Unmanaged Dll I get implicit results in my .net application.

  • How to declare and use multi dimensional VARRAYs in PLSQL

    Hi All,
    I am trying to create and use multidimensional varray in plsql code...
    can anyone let me know, how can I do this...
    Thanks
    Krishna

    Please do not confuse plsql collections with type objects.Well it's possible with persistent types but nested tables and varrays typically need to be explicitly initialized and extended.
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
    SQL> CREATE OR REPLACE TYPE name_type_size IS VARRAY (3) OF VARCHAR2 (50);
      2  /
    Type created.
    SQL> CREATE OR REPLACE TYPE name_type_size_array IS VARRAY (200) OF name_type_size;
      2  /
    Type created.
    SQL> DECLARE
      2     i_name_type_size_array name_type_size_array :=  name_type_size_array ();
      3  BEGIN
      4     FOR count1 IN 1 .. 200 LOOP
      5
      6        i_name_type_size_array.EXTEND;
      7        i_name_type_size_array (count1) := name_type_size ();
      8
      9        FOR count2 IN 1 .. 3 LOOP
    10
    11           i_name_type_size_array (count1).EXTEND;
    12           i_name_type_size_array (count1) (count2) := count2;
    13
    14        END LOOP;
    15
    16     END LOOP;
    17  END;
    18  /
    PL/SQL procedure successfully completed.
    SQL>

  • Pro*C program to use a REF CURSOR returned by a DB Function

    Hi,
    Please help me with this.
    I have a pro*c program that should call a
    database function which returns a ref cursor.
    This is the sample code i have :-
    EXEC SQL BEGIN DECLARE SECTION;
    SQL_CURSOR emptycabin_cursor;
    int cabinid;
    EXEC SQL END DECLARE SECTION;
    EXEC SQL ALLOCATE :emptycabin_cursor;
    EXEC SQL EXECUTE BEGIN
    :emptycabin_cursor:=posremptycabin(:voy,:segid);
    END;END-EXEC;
    /* more_records = 1*/
    while (more_records)
    EXEC SQL FETCH :emptycabin_cursor INTO :cabinid;
    if (SQLCODE==NOTFOUND)
    {more_records=FALSE;break;}
    EXEC SQL close :emptycabin_cursor;
    When I execute I keep getting fetch out of sequence error.
    Can someone let me know whats wrong with this code?
    When I execute the function from sqlplus
    variable ref_cur refcursor ;
    exec :ref_cur:=posremptycabin(232,'CC');
    print :ref_cur;
    I get the data properly displayed.So nothing wrong with the function.
    Thanks for your help

    I know nothing about Pro*C, but Tom Kyte's Pro*C example for ref cursors fetches the cursor with a loop that looks like:
    for( ;; )
            EXEC SQL WHENEVER NOTFOUND DO break;
            EXEC SQL FETCH :my_cursor INTO :ename, empno;
            printf( "'%.*s', %d\n", ename.len, ename.arr, empno );
        EXEC SQL CLOSE :my_cursor;http://asktom.oracle.com/~tkyte/ResultSets/index.html
    Hope this helps.

  • Ref cursor to object  and return to ref cursor

    how i will call object type from refcursor and return value to ref cursor .

    I need a help. please help me.
    takes oracle object types as input/output.
    PROCEDURE createserviceorder(
    P_serviceorder IN serviceorder,
    P_serviceid in out p_sm_type.serviceid,
    P_serviceorderid out p_sm_type.serviceorderid,
    Returnstatus out callstatus);
    The serviceorder, callstatus are oracle object types.
    The wrapper procedure for this API would be something like the example with pseudo code below
    PROCEDURE createserviceorderwrapper(
    P_serviceorder IN REFCURSOR,
    P_serviceid in out p_sm_type.serviceid,
    P_serviceorderid out p_sm_type.serviceorderid,
    Returnstatus out REFCURSOR)
    Map from ref cursor P_serviceorder to oracle object for serviceorder;
    Map from other data types to local variables;
    Call createserviceorder (pass the parameters here and get output….);
    Map output callstatus to its equivalent REF CURSOR variable;
    Return callstatus (and other out parameters if any )as REF CURSORS;
    }

  • How to declare and use olevar

    Hi
    I need to declare olevar variable and use it. Can anybody kindly help?
    Thanks

    DECLARE
    scan_ole oleobj;
    edit_ole oleobj;
    file_ole oleobj;
    ole_filetype olevar := to_variant(1);
    ole_pagetype olevar := to_variant(1);
    ole_compressiontype olevar :=to_variant(2);
    ole_compressioninfo olevar := to_variant(8);
    dummy NUMBER;
    lst ole2.list_type;
    scancomplete BOOLEAN;
    a NUMBER;
    b VARCHAR2 (2000);
    v_error VARCHAR2 (50);
    scanerror EXCEPTION;
    PRAGMA EXCEPTION_INIT (scanerror, -20010);
    BEGIN
    forms_ole.ACTIVATE_SERVER ('ocx');
    scan_ole := forms_ole.GET_INTERFACE_POINTER ('OCX');
    IF imaging_dimgscan.scanneravailable (scan_ole) <> 0
    THEN
    dummy := imaging_dimgscan.startscan (scan_ole);
    scancomplete := TRUE;
    ELSE
    scancomplete := FALSE;
    v_error := 'Scanner not available';
    RAISE scanerror;
    END IF;
    IF scancomplete
    THEN
    forms_ole.ACTIVATE_SERVER ('EDIT');
    edit_ole := forms_ole.GET_INTERFACE_POINTER ('EDIT');
    b := imaging_dimgscan.destimagecontrol (edit_ole);
    imaging_dimgscan.destimagecontrol (edit_ole, b);
    a := imaging_dimgscan.closescanner (scan_ole);
    GO_BLOCK ('SCANNED_IMAGES');
    :SYSTEM.message_level := 25;
    forms_ole.ACTIVATE_SERVER ('FILE');
    FILE_ole := forms_ole.GET_INTERFACE_POINTER ('FILE');
    IMAGING_DIMGEDIT.SAVEAS(edit_ole,'C:\scan0001.tif');
    --IMAGING_DIMGEDIT.SaveAs( edit_ole,'C:\scan0001.tif',ole_filetype,ole_pagetype,ole_compressiontype);
    READ_IMAGE_FILE ('C:\scan0001.tif', 'ANY', 'SCANNED_IMAGES.IMAGE_DATA');
    IF NOT FORM_SUCCESS
    THEN
    v_error := ' Could not read image file';
    :SYSTEM.message_level := 0;
    RETURN;
    END IF;
    :SYSTEM.message_level := 0;
    IF :scanned_documents.zoom_amount IS NOT NULL
    THEN
    IMAGE_ZOOM ('SCANNED_IMAGES.image_data',
    zoom_percent,
    :scanned_documents.zoom_amount
    END IF;
    :scanned_images.page_count := TO_NUMBER (:GLOBAL.pagecount);
    :scanned_images.description := 1;
    :scanned_images.page_number := 1;
    END IF;
    EXCEPTION
    WHEN scanerror
    THEN
    a := imaging_dimgscan.closescanner (scan_ole);
    MESSAGE (v_error || ' ' || SQLCODE || ' ' || SQLERRM);
    WHEN OTHERS
    THEN
    a := imaging_dimgscan.closescanner (scan_ole);
    MESSAGE (v_error || ' ' || SQLCODE || ' ' || SQLERRM);
    END;
    The called method
    /*PROCEDURE SaveAs(interface OleObj, Image VARCHAR2, FileType OleVar := OleVar_Null,
         PageType OleVar := OleVar_Null, CompressionType OleVar := OleVar_Null, CompressionInfo OleVar := OleVar_Null,
         SaveAtZoom OleVar := OleVar_Null) IS
    BEGIN
    Init_OleArgs(6);
    Add_OleArg(Image);
    Add_OleArg(FileType);
    Add_OleArg(PageType);
    Add_OleArg(CompressionType);
    Add_OleArg(CompressionInfo);
    Add_OleArg(SaveAtZoom);
    Call_Ole(interface, 343);
    End;
    Where do I go wrong?? The first saveAs works but not the second one!!!

  • Problem deploying and using custom Tags in jar files

    I am trying to create a custom tag library of Java classes, package them in a JAR file, and use them in another web application. Here is the JAR file structure, named mytags.jar:
    META-INF
    META-INF/manifest.mf
    META-INF/taglib.tld
    mytags/FooBar.class
    mytags/Another.class
    ...Here is the taglib.tld file:
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <taglib xmlns="http://java.sun.com/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-jsptaglibrary_2_0.xsd"
    version="2.0">
       <tlib-version>1.0</tlib-version>
       <short-name>foo</short-name>
       <uri>fooTags</uri>
       <info>My tags</info>
       <tag>
         <name>fooBar</name>
         <tag-class>mytags.FooBar</tag-class>
         <body-content>empty</body-content>
         <attribute>
           <name>name</name>
           <required>false</required>
           <rtexprvalue>true</rtexprvalue>
         </attribute>
      </tag>
    </taglib>The FooBar class has getName(String) and setName() methods.
    In the web application, I have copied mytags.jar into the WEB-INF/lib directory. I've verified that it lands in the corresponding directory for my appserver (I'm using Tomcat 6.0.10).
    Here's the header for my JSP:
    <%@ page language="java" contentType="text/html;charset=UTF-8" %>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@ taglib uri="fooTags" prefix="foo" %>
    <foo:fooBar name="dummy" />
    ...When I access my page, the browser sits there and spins, not able to do anything. I know that some of the content is executed, but it is not able to get to the fooTags. I have tried replacing fooTags with WEB-INF/lib/mytags.jar, to no effect.
    According to the docs, I should not need to include anything in web.xml to reference the fooTags. The tag library classes are valid, since I used them as local tags prior to moving them into a Jar library.
    Any help would be appreciated

    Take the code of the jsp file :
    <%@ page language="java" %>
    <%@ taglib uri="WEB-INF/struts-html.tld" prefix="html" %>
    <html>
       <head>
         <title> First Struts Application </title>
       </head>
         <body>
            <table width="500" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td> </td>
            </tr>
            <tr bgcolor="#36566E">
              <td height="68" width="48%">
                <div align="left">
                  <img src="images/hht.gif" width="220" height="74">
                </div>
              </td>
            </tr>
            <tr>
             <td> </td>
            </tr>     
           </table>
           <html:form action="Lookup"
                      name="lookupForm"
                      type="wiley.LookupForm" >
           <table width="45%" border="0">
            <tr>
              <td>Symbol:</td>
              <td><html:text property="symbol" /> </td>
            </tr>
             <tr>       
              <td colspan="2" align="center"><html:submit/> </td>
             </tr>       
            </table>              
          </html:form>
         </body>
    </html>

  • ORA-12714 error using NVARCHAR2, REF CURSOR and TABLE FUNCTION

    Hello,
    we have tested this simple script on all the following versions of Oracle: 9.2.0.3, 10.2.0.1.0 , 11.1.0.6.0 - but we got the same error in everyone of these.
    CREATE OR REPLACE TYPE Rec_Prova IS OBJECT(
        Id INTEGER,
        NodeValue NVARCHAR2(50)
    CREATE OR REPLACE TYPE Tab_Prova IS TABLE OF Rec_Prova;
    DECLARE
        CurProva SYS_REFCURSOR;
        varTable Tab_Prova := Tab_Prova();
    BEGIN
        OPEN CurProva FOR
            SELECT Id, NodeValue FROM TABLE(CAST(varTable AS Tab_Prova));
    END;The error is: "ORA-12714: invalid national character set specified"
    We know that changing the type of NodeValue from NVARCHAR2 to NCLOB it works, but the performances are very poor.
    Therefore this solution is not acceptable for us.
    We also know that if the character set of the database is set to unicode (NLS_NCHAR_CHARACTERSET = AL16UTF16) we can use the VARCHAR2 for store also the unicode characters and the problem is solved. But some of our customers can't change the settings of theirs databases... moreover, in this forum someone says:
    "To all dba's who try to change the NLS_CHARACTERSET or NLS_NCHAR_CHARACTERSET by updating props$ . This is NOT supported and WILL corrupt your database. This is one of the best way's to destroy a complete dataset. Oracle Support will TRY to help you out of this but Oracle will NOT warrant that the data can be recoverd or recovered data is correct. Most likely you WILL be asked to do a FULL export and a COMPLETE rebuild of the database."
    Is there any workaround except the two that I have mentioned?
    Thank you in advance.
    Edited by: user11929330 on 22-set-2009 7.50

    ORA-12714: invalid national character set specified
    Cause: Only UTF8 and AL16UTF16 are allowed to be used as the national character set
    Action: Ensure that the specified national character set is valid
    So it looks like that you should change the character set or go for NCLOB (and if you're on version 11, maybe securefiles gives you the performance you want).
    -Andy

Maybe you are looking for