Converting an old Tom Kyte function to straight SQL

I am on Oracle 10.2
There is an old tom kyte function (10+ years old) floating around that will remove constants so I can look for queries that don't use bind variables. It has to loop through each character i a sql so its slow. I was able to convert part of it to using a regular expression. There are alot of new SQL features, so I am trying to replace it with sql.
The old REMOVE_CONSTRAINTS function is at the bottom.
I have already converted the really slow part of the function which loops through every character in a query (first loop). I did it with a regular expression. See test case below.
I am having trouble with the second part that replaces numbers.
The translate is there because I was having trouble passing a single quote to a regular expression and got tired of looking at it. So I converted all single quotes to '@''
Basically the translate turns all single quotes to @
So anything surrounded by an @ and an @ gets turned into a single @
This is a bit flawed. If I have a literal that has a quote in it, this will get screwed up. It is not something I have to worry about right now though.
select mytest,regexp_replace(translate(to_char(mytest),chr(39),'@'),'@[^@]+@','@') from test
create table test (mytest clob);
insert into test values ('select 1 from mytable where x = '||chr(39)||'v'||chr(39)||' and y = '||chr(39)||'q'||chr(39));
insert into test values ('select 1 from mytabe where a = '||chr(39)||'xyz'||chr(39));
commit;
SQLt>  select mytest,regexp_replace(translate(mytest,chr(39),'@'),'@[^@]+@','@') from test
  2  /
MYTEST
REGEXP_REPLACE(TRANSLATE(MYTEST,CHR(39),'@'),'@[^@]+@','@')
select 1 from mytable where x = 'v' and y = 'q'
select 1 from mytable where x = @ and y = @
select 1 from mytabe where a = 'xyz'
select 1 from mytabe where a = @I can put this in a pipeline function and it will run fast enough. I think I can probably make this straight sql. anyone know how? also, I have some column names with numbers in it. anyone know a good way to ignore numbers on the left side of the where clause?
    l_query := translate( l_query, '0123456789', '@@@@@@@@@@' );
--   dbms_output.put_line(l_query);  
    for i in 0 .. 8 loop
        l_query := replace( l_query, lpad('@',10-i,'@'), '@' );
        l_query := replace( l_query, lpad(' ',10-i,' '), ' ' );
    end loop;
  function remove_constraints ( p_query in clob ) return clob AS
    l_query clob;
    l_char  varchar2(1);
    l_in_quotes boolean default FALSE;
    l_length number := 0;
    vmodule varchar2(30);
    vaction varchar2(30);
begin
    dbms_application_info.read_module(vaction,vmodule);
    dbms_application_info.set_module(vaction,nvl(vmodule,0)+1);
    for i in 1 .. length( p_query )
    loop
        l_char := substr(p_query,i,1);
        if ( l_char = '''' and l_in_quotes )
        then
            l_in_quotes := FALSE;
        elsif ( l_char = '''' and NOT l_in_quotes )
        then
            l_in_quotes := TRUE;
            l_query := l_query || '''#';
            dbms_output.put_line('a '||l_char);
            dbms_output.put_line( '''#');
        end if;
        if ( NOT l_in_quotes ) then
            l_query := l_query || l_char;
        end if;
    end loop;
--dbms_output.put_line(l_query); 
    l_query := translate( l_query, '0123456789', '@@@@@@@@@@' );
--   dbms_output.put_line(l_query);  
    for i in 0 .. 8 loop
        l_query := replace( l_query, lpad('@',10-i,'@'), '@' );
        l_query := replace( l_query, lpad(' ',10-i,' '), ' ' );
    end loop;
    return upper(l_query);
end;
   

In 10g you can use
FORCE_MATCHING_SIGNATURE     The signature used when the CURSOR_SHARING parameter is set to FORCE
http://docs.oracle.com/cd/B19306_01/server.102/b14237/dynviews_2113.htm#REFRN30246

Similar Messages

  • Can I convert an old IMAC computer with OS 9 operating system from being "dial up" to high speed?

    Can anyone tell me how I can convert my old IMAC from "dial up" to go on the internet as high speed? I have an ISP provider for a more modern computer that I own, but I really would like to use my old IMAC on the internet as well? How can I make it compatible with high speed internet? If I try to go on line, the internal modem "dials up". How can I change that and cause it to communicate with my external high speed modem?

    Any iMac can connect by ethernet to the router.
    You'll need to disable the modem and set up the network config.
    Too long since I used OS9 to guide you on that bit; ask in the correct forum;
    https://discussions.apple.com/community/mac_os/classic_mac_os     or;
    https://discussions.apple.com/community/desktop_computers/imac_powerpc

  • Where in migration process does old server stop functioning as primary server?

    I am migrating from a SBS 2003 box to a new WS 2012 R2 Essentials box - following the instructions from 
    "Migrate from Previous Versions to Windows Server 2012 R2 Essentials or Windows Server Essentials Experience".   What I need to know is where in the process does
    the old server stop functioning as a server for my network.   What I mean by this is when in the migration process (when I add the new server as a replicate DC?  not until I demote the old server?) will any programs/databases on the old server no
    longer be available to client computers?  
    Thanks for any insight.

    Yeah, we need to agree on what is meant by "the server". In Windows, Server means many different things. Each time you move, a role or feature from the "old" to the "new" the old server ceases to function as "the server"
    for that role or feature. The basic functions of a Windows DC include Active Directory, 5 FSMO roles, file and print services, and application services to name just a few.
    So the answer to your question is more to do with what you mean by "server".  In particular, for the application role, you must move the app to the new server by whatever means the developer recommends.  At that point, regardless of whatever
    else is going on the old server is out of the picture for that application.
    Larry Struckmeyer[MVP] If your question is answered please mark the response as the answer so that others can benefit.

  • Are there detailed instructions how to convert an old (PSE8) Catalog to PSE12?

    As part of my upgrade from WinXP to Win7 on a replacement PC, I have purchased the new version of Elements, having used PSE8 for years. The handbook for my new PSE12 gives incredibly brief instructions (on P7). After PSE12 installation, it automatically offers to convert the old Catalog. I have followed that through the conversion, but then I can't get the converted Catalog back! What am I doing wrong?

    Golden Shot wrote:
    As part of my upgrade from WinXP to Win7 on a replacement PC, I have purchased the new version of Elements, having used PSE8 for years. The handbook for my new PSE12 gives incredibly brief instructions (on P7). After PSE12 installation, it automatically offers to convert the old Catalog. I have followed that through the conversion, but then I can't get the converted Catalog back! What am I doing wrong?
    So, you changed not only your OS and PSE version, but you also changed the computer? In that case a catalog conversion won't restore your image files. That only works if your changes take place on the same computer.
    You'll have to follow this procedure:
    Use Backup, Restore to move catalog | Organizer | Elements 6 or later
    And come back for any additional advice.

  • Help needed Converting MSSQL function to PL/SQL

    Hello,
    I have the following MSSQL code which I need to migrate to Oracle 10g. The problem I am having is the MSSQL code creates a temp table as the return type and I am unsure how to get the same functionality in PL/SQL.
    MSSQL CODE_
    CREATE FUNCTION [dbo].[QueryCurrentWhy]
    @ColumnID INT,
    @GroupID INT,
    @Parents VARCHAR(8000)
    RETURNS @R TABLE(ID1 int IDENTITY (1, 1) NOT NULL, ID2 int, ColID int, [Name] VARCHAR(255), Tlevel int, ParentID int, Processed BIT)
    AS
    BEGIN
    RETURN
    END
    The code I have currently written in PL/SQL is below. I firstly create a global temp table and then a sequence and trigger for it. I then create the Function in the hope I can specify the temp table as the return type. Problem is I get the error "PLS-00201: identifier 'TEMPR' must be declared". Im guessing this is because the temp table is declared outside the function declaration?
    ORACLE CODE_
    CREATE GLOBAL TEMPORARY TABLE tempR
    ID1 INT NOT NULL,
    ID2 INT,
    ColID INT,
    Name VARCHAR2(255),
    Tlevel INT,
    ParentID INT,
    Processed CHAR(1)
    CREATE SEQUENCE gCounter
         START WITH 1
         INCREMENT BY 1
    CREATE OR REPLACE TRIGGER gTrigger
    BEFORE INSERT ON tempR
    FOR EACH ROW
    DECLARE TEMP_NO INT;
    BEGIN
         SELECT gCounter.NEXTVAL INTO TEMP_NO FROM DUAL;
    :NEW.ID1 := TEMP_NO;
    END;
    CREATE OR REPLACE FUNCTION TSORADB.QueryCurrentWhy
    aColumnID INT,
    aGroupID INT,
    aParents VARCHAR2(8000)
    RETURN tempR
    AS
    BEGIN
    RETURN;
    EXCEPTION when NO_DATA_FOUND then null;
    END;
    Basically is it possible for me to declare the temp table in the return statement, if not then what is the best way to go about this?
    Thanks in advance
    Toby
    Edited by: redeye on Jul 27, 2009 3:26 PM

    Unfortunately I didnt write the original function or stored procedure and the person who did is no longer with the company, so apologies for any confusion with what I am saying.
    Maybe it'll be more helpful if i paste the contents of the function?
    CREATE OR REPLACE FUNCTION TSORADB.QueryCurrentWhy
    aColumnID INT,
    aGroupID INT,
    aParents VARCHAR2(8000)
    RETURN tempR
    AS
    --BEGIN
    aPKColTypeID INT;
    aFKDColTypeID INT;
    aFKDSColTypeID INT;
    aFKIColTypeID INT;
    aColType VARCHAR2(30);
    aTableID INT;
    aName VARCHAR2(255);
    aNameWhyMost VARCHAR2(255);
    aNameWhyMost2 VARCHAR2(255);
    aLongNameStr VARCHAR2(1000);
    aConnectStr VARCHAR2(1000);
    aColID INT;
    aColIDWhyMost INT;
    aColIDWhyMost2 INT;
    aColIDWhyMostLast INT;
    aCount INT;
    aID1 INT;
    aID2 INT;
    aPreID2 INT;
    aMaxID2 INT;
    aCurrentID2 INT;
    aTLevel INT;
    aTLevel2 INT;
    aTlevelLast INT;
    aNewLevel INT;
    aMaxTLevel INT;
    aMaxTLevel2 INT;
    aParentID INT;
    aParentID2 INT;
    aNewParentID INT;
    aProcessed number (1);
    --aCurVar1 CURSOR;
    aParent INT; aStrEntityIDSet varchar(2000); aStrPipeSepValsInput varchar(2000); aEndPointInput int; aSeperatorIndex int;
    aNumTempDoc INTEGER := 0;
    --aColumnID INT DEFAULT(0);
    --aGroupID INT DEFAULT(0);
    --aParents VARCHAR(8000) DEFAULT('');
    BEGIN
    SELECT ColumnTypeID INTO aPKColTypeID FROM TSORADB.HKColumnType WHERE ColumnTypeName = 'PK';
    SELECT ColumnTypeID INTO aFKDColTypeID FROM TSORADB.HKColumnType WHERE ColumnTypeName = 'FKD';
    SELECT ColumnTypeID INTO aFKDSColTypeID FROM TSORADB.HKColumnType WHERE ColumnTypeName = 'FKDS';
    SELECT ColumnTypeID INTO aFKIColTypeID FROM TSORADB.HKColumnType WHERE ColumnTypeName = 'FKI';
    IF (aGroupID is null)
    THEN
         aGroupID := -1;
    END IF;
    --Tokenize the parent array and get back a set of values.
    IF(aParents is not null)
    THEN
    BEGIN
         aStrEntityIDSet := aParents;
         aStrPipeSepValsInput := '|' + ltrim(rtrim(aStrEntityIDSet)) + '|';
         --print aStrPipeSepValsInput
         aEndPointInput := INSTR(aStrPipeSepValsInput, '|');
         aStrPipeSepValsInput := INSTR (aStrPipeSepValsInput, LENGTH (aStrPipeSepValsInput) - aEndPointInput); -- take out the '|' pattern
         WHILE (LENGTH (aStrPipeSepValsInput) > 0)
         LOOP
         BEGIN
              aEndPointInput := INSTR(aStrPipeSepValsInput, '|'); -- get the next '|' pattern
              aParent := SUBSTR(aStrPipeSepValsInput, 1, aEndPointInput - 1);
              --PRINT 'aParent is ' + CONVERT (NVARCHAR, aParent)
              aStrPipeSepValsInput := INSTR (aStrPipeSepValsInput, LENGTH (aStrPipeSepValsInput) - aEndPointInput);
              INSERT INTO TmpParent (ColID) VALUES (aParent);
         END;
         END LOOP;
    END;
    END IF;
    SELECT hkc.TableID, hkc.Name, hkct.ColumnTypeName
    INTO aTableID, aName, aColType
    FROM TSORADB.HKColumns hkc
    INNER JOIN TSORADB.HKColumnType hkct on hkc.ColTypeID = hkct.ColumnTypeID
    WHERE hkc.ColumnID = aColumnID;
    IF aColType in ('PK','PKD')
    THEN
         -- Generate Unique Path Table Start
         SELECT
         CASE WHEN FKIs3.Name is null
         THEN PKs3.Name
         ELSE FKIs3.Name
         END Name
         INTO aName
         FROM TSORADB.HKColumns PKs3
         INNER JOIN
         SELECT hkc3.TableID FROM TSORADB.HKColumns hkc3
         WHERE hkc3.ColumnID = aColumnID
         ) HKC3 ON PKs3.TableID = HKC3.TableID
         LEFT OUTER JOIN
         SELECT TableID, Name
         FROM TSORADB.HKColumns
         WHERE ColTypeID = aFKIColTypeID
         ) FKIs3 ON PKs3.TableID = FKIs3.TableID
         WHERE PKs3.ColTypeID = aPKColTypeID AND ((aGroupID=-1 AND PKs3.GroupID IS NULL) OR PKs3.GroupID=aGroupID);     
    END IF;
    -- Insert query column itself
    aTlevel := 0;
    aParentID := 0;
    aID2 := 1;
    IF (aColType = 'ATT')
    THEN
    BEGIN
    INSERT INTO tempR(ID2, ColID, Name, Tlevel, ParentID, Processed)
    SELECT distinct aID2, TopHKCs.ColumnID as ColID, aName as Name,aTlevel as Tlevel, aParentID as ParentID, 1 as Processed
         FROM TSORADB.HKColumns TopHKCs
    WHERE TopHKCs.ColumnID = aColumnID;
    aID2 := aID2 + 1;
    aTlevel := 1;
         aParentID := aColumnID;
         -- Get the non-compound name for the parent
         SELECT
         CASE WHEN FKIs3.Name is null
         THEN PKs3.Name
         ELSE FKIs3.Name
         END Name
         INTO aName
         FROM TSORADB.HKColumns PKs3
         INNER JOIN
         SELECT hkc3.TableID FROM TSORADB.HKColumns hkc3
         WHERE hkc3.ColumnID = (SELECT ColumnID FROM TSORADB.HKColumns WHERE TableID = aTableID AND ColTypeID = aPKColTypeID)
         ) HKC3 ON PKs3.TableID = HKC3.TableID
         LEFT OUTER JOIN
         SELECT TableID, Name
         FROM TSORADB.HKColumns
         WHERE ColTypeID = aFKIColTypeID
         ) FKIs3 ON PKs3.TableID = FKIs3.TableID
         WHERE PKs3.ColTypeID = aPKColTypeID AND ((aGroupID=-1 AND PKs3.GroupID IS NULL) OR PKs3.GroupID=aGroupID);
         INSERT INTO tempR(ID2, ColID, Name, Tlevel, ParentID, Processed)
    SELECT aID2, ColumnID, aName, aTlevel, aParentID, 0
    FROM TSORADB.HKColumns
         WHERE TableID = aTableID
         AND ColTypeID = aPKColTypeID;
    aID2 := aID2 + 1;
    END;
    ELSE
    BEGIN
         INSERT INTO TmpR1(ColID, Name, Tlevel, ParentID, Processed)
         SELECT nonCompoundHks.ColumnID as ColID, aName as Name,aTlevel as Tlevel, aParentID as ParentID, 0 as Processed
         FROM TSORADB.HKColumns nonCompoundHks
         WHERE nonCompoundHks.Name = aName --lower(nonCompoundHks.Name) = lower(aName)
         AND ((aGroupID=-1 AND nonCompoundHks.GroupID IS NULL) OR nonCompoundHks.GroupID=aGroupID)
         AND nonCompoundHks.ColTypeID = aPKColTypeID
         AND EXISTS
              select ColumnID
              From TSORADB.HKColumns hkc4
              WHERE hkc4.TableID = nonCompoundHks.TableID
              AND (hkc4.ColTypeID = aFKDColTypeID OR hkc4.ColTypeID = aFKDSColTypeID)
         AND NOT EXISTS
              select ColumnID
              From TSORADB.HKColumns hkc5
              WHERE hkc5.TableID = nonCompoundHks.TableID
              AND hkc5.ColTypeID = aFKIColTypeID
              AND ((aGroupID=-1 AND hkc5.GroupID IS NULL) OR hkc5.GroupID=aGroupID)
         INSERT INTO TmpR1(ColID, Name, Tlevel, ParentID, Processed)
         SELECT compoundPk.ColumnID as ColID, aName as Name,aTlevel as Tlevel, aParentID as ParentID, 0 as Processed
         FROM TSORADB.HKColumns compoundPk
         INNER JOIN TSORADB.HKColumns compoundHkc on compoundHkc.TableID = compoundPk.TableID AND compoundHkc.ColTypeID = aFKIColTypeID
    INNER JOIN (
              SELECT hkc.ColumnID
              FROM TSORADB.HKColumns hkc
              WHERE hkc.ColTypeID = aPKColTypeID
              AND hkc.Name = aName --lower(hkc.Name) = lower(aName)
              AND ((aGroupID=-1 AND hkc.GroupID IS NULL) OR hkc.GroupID=aGroupID)
              AND NOT EXISTS
              select ColumnID
              From TSORADB.HKColumns hkc2
              WHERE hkc2.TableID = hkc.TableID
              AND (hkc2.ColTypeID = aFKDColTypeID OR hkc2.ColTypeID = aFKDSColTypeID)
              AND ((aGroupID=-1 AND hkc2.GroupID IS NULL) OR hkc2.GroupID=aGroupID)
    ) Indys ON Indys.ColumnID = compoundHkc.ForeignKey
         WHERE compoundPk.ColTypeID = aPKColTypeID;
         INSERT INTO tempR(ID2, ColID, Name, Tlevel, ParentID, Processed)
         SELECT ID2, ColID, Name, Tlevel, ParentID, Processed FROM TmpR1;
         FETCH FROM aCurVar1 INTO aColID, aName, aTlevel, aParentID, aProcessed
         WHILE aafetch_status = 0
         BEGIN     
              IF(aParents is null or EXISTS (SElECT ColID FROM aTmpParent WHERE ColID = aColID) )
              BEGIN
                   INSERT INTO tempR(ID2, ColID, [Name], Tlevel, ParentID, Processed) VALUES(aID2, aColID, aName, aTlevel, aParentID, aProcessed)
                   SET aID2 = aID2 + 1
              END
              FETCH NEXT FROM aCurVar1 INTO aColID, aName, aTlevel, aParentID, aProcessed
         END
         CLOSE aCurVar1 */
    END;
    END IF;
         begin
         SELECT COUNT(*) INTO aNumTempDoc FROM tempR WHERE Processed = 0 and Tlevel < 1;
         end;
    WHILE aNumTempDoc > 0
    LOOP
    BEGIN
    -- Get current row
         SELECT ID1, ID2, ColID, Name, Tlevel, ParentID
         INTO aID1, aID2, aColID, aName, aTlevel, aParentID
         FROM tempR
         WHERE Processed = 0 AND ROWNUM = 1
         ORDER BY ID1;
    UPDATE tempR SET processed = 1 WHERE ID1 = aID1;
    aPreID2 := aID2;
    -- Get why parents
    declare CURSOR aCurVar1 IS --SELECT * FROM TSORADB.HKColumns;
         SELECT distinct FKDPKs.ColumnID as ColID,
              CASE WHEN FKDFKI.NAME is null
              THEN FKDPKs.Name
              ELSE FKDFKI.Name
              END Name,
         (aTlevel+1) as Tlevel,
         PREHKCs.ColID AS ParentID,
         0 as Processed
         FROM TSORADB.HKColumns FKDPKs
         INNER JOIN
         TSORADB.HKColumns FKDFKs ON FKDPKs.ColumnID = FKDFKs.ForeignKey
    INNER JOIN
         TSORADB.HKColumns FKDFKs2 ON FKDFKs2.TableID = FKDFKs.TableID
         INNER JOIN
         tempR PREHKCs ON PREHKCs.ColID=aColID AND PREHKCs.ColID = FKDFKs2.ColumnID AND PREHKCs.Tlevel=aTlevel
         LEFT OUTER JOIN
         SELECT TableID, Name, GroupID
         FROM TSORADB.HKColumns
         WHERE ColTypeID = aFKIColTypeID
         ) FKDFKI ON FKDFKI.TableID = FKDPKs.TableID
         INNER JOIN TSORADB.HKColumnType ON FKDPKs.ColTypeID=HKcolumnType.ColumnTypeID
         WHERE FKDPKs.ColTypeID=aPKColTypeID AND FKDPKs.ColumnID <> aColumnID
         AND FKDFKs.ColTypeID=aFKDColTypeID
    AND ((aGroupID=-1 AND FKDPKs.GroupID IS NULL) OR FKDPKs.GroupID=aGroupID);
         BEGIN
    OPEN aCurVar1;
    aCount := 1;
    SELECT MAX(ID2) INTO aID2 FROM tempR;
    LOOP
         FETCH aCurVar1 INTO aColID, aName, aTlevel, aParentID, aProcessed;
         Exit when aCurVar1%NOTFOUND; -- Exit the loop when no more rows are found.
    --WHILE aafetch_status = 0
    BEGIN
    IF (aCount = 1) -- The first Why Parent
              THEN
                   INSERT INTO tempR(ID2, ColID, Name, Tlevel, ParentID, Processed) VALUES(aPreID2, aColID, aName, aTlevel, aParentID, 0);
    ELSE -- The multiple Why Parents
    BEGIN
                   aID2 := aID2 + 1;
    -- Copy the previous parent with increased ID2
    INSERT INTO tempR(ID2, ColID, Name, Tlevel, ParentID, Processed) SELECT aID2 as ID2, ColID, Name, Tlevel, ParentID, 1 AS Processed FROM tempR WHERE ID1 <= aID1 AND ID2 = aPreID2;
    -- Insert the new why parent
    INSERT INTO tempR(ID2, ColID, Name, Tlevel, ParentID, Processed) VALUES(aID2, aColID, aName, aTlevel, aParentID, 0);
    END;
    END IF;          
    aCount := aCount + 1;
              --FETCH NEXT FROM aCurVar1 INTO aColID, aName, aTlevel, aParentID, aProcessed;
    END;
         END LOOP;
    CLOSE aCurVar1;
         END;
         SELECT COUNT(*) INTO aNumTempDoc FROM tempR WHERE Processed = 0 and Tlevel < 1;
    END;
    END LOOP;
    -- Generate Unique Path Table End
    RETURN;
    EXCEPTION when NO_DATA_FOUND then null;
    END;
    The table which is returned to the SProc is used in the following way, (MSSQL code, as am yet to migrate). Basically using some of the returned column values along with DB values to populate a second temp table
    INSERT INTO #TmpR1 SELECT * FROM QueryCurrentWhy(@ColumnID, @GroupID, @Parents)
    SET @Tlevel = 1
    INSERT INTO @R
    SELECT HKColumns.Columnid as ColID, HKColumns.Tableid as TblID, R1.Name as [Name], HKColumns.NounID AS KeyCompA, R1.ParentID AS KeyCompB, HKColumns.ColTypeID as ColTypeID, ColumnTypeName as ColType, 0 as HasWhats,
    CASE WHEN R2.ColID is null
    THEN 0
    ELSE 1
    END HasWhyParent,
    0 as IsSelected
    FROM HKColumns
    INNER JOIN #TmpR1 AS R1
    ON HKColumns.ColumnID = R1.ColID AND R1.Tlevel=@Tlevel
    INNER JOIN HKColumnType
    ON HKColumns.ColTypeID=HKcolumnType.ColumnTypeID AND HKColumns.ColTypeID=@PKColTypeID
    LEFT JOIN #TmpR1 AS R2
    ON R2.ID2 = R1.ID2 AND R2.Tlevel=@Tlevel+1 AND R2.ParentID=R1.ColID

  • Strange happenings with examples from Tom Kyte's book. 10 XE

    Hi all,
    I was twiddling my thumbs and decided to brush up on some of Oracle's fundamentals.
    Tom Kyte's book - Effective Oracle by Design. Examples on pp. 141 - 142 (to do with
    bind variables). Typed in the example and obtained a very strange system reaction.
    It consists of a package "DEMO_141_PKG" with 1 procedure "parse_bind_execute_close"
    which is called by the procedure QUICKFIX142.. The system then proceeds to go mental.
    If anybody could explain to me what's going on, I would be grateful. I'm running 10 XE on
    Ubuntu Linux.
    On running the code (below) I get this in the "Run" window of SQLDeveloper.
    Connecting to the database demo.
    ORA-01000: maximum open cursors exceeded
    ORA-06512: at "SYS.DBMS_SYS_SQL", line 884
    ORA-06512: at "SYS.DBMS_SQL", line 9
    ORA-06512: at "DEMO.DEMO_141_PKG", line 17
    ORA-06512: at "DEMO.QUICKFIX142", line 8
    ORA-06512: at line 2And the logging window of SQLDevloper just shows a continuous
    stream of the text below - I have to kill the sessions as SYS from
    within Oracle - the Terminate process from within SQLDeveloper
    doesn't manage to kill this runaway process.
    Logging output
    SEVERE     2474100     1     oracle.dbtools.raptor.runner.DBStarterFactory     logDbmsOutput: ORA-01000: maximum open cursors exceeded
    SEVERE     2474099     1     oracle.dbtools.raptor.runner.DBStarterFactory     logDbmsOutput: ORA-01000: maximum open cursors exceeded
    SEVERE     2474098     0     oracle.dbtools.raptor.runner.DBStarterFactory     logDbmsOutput: ORA-01000: maximum open cursors exceeded
    SEVERE     2474097     0     oracle.dbtools.raptor.runner.DBStarterFactory     logDbmsOutput: ORA-01000: maximum open cursors exceeded
    SEVERE     2474096     1     oracle.dbtools.raptor.runner.DBStarterFactory     logDbmsOutput: ORA-01000: maximum open cursors exceeded
    <Millions of lines snipped - it just keeps going>Now, the code is here for those who would like to help me get to the bottom of this phenomenon.
    create or replace
    PACKAGE DEMO_141_PKG AS
    procedure parse_bind_execute_close(p_input in varchar2);
    END DEMO_141_PKG;
    create or replace
    PACKAGE BODY DEMO_141_PKG AS
      g_first_time boolean := TRUE;
      g_cursor number;
    procedure parse_bind_execute_close(p_input in varchar2)
    AS
      l_cursor number;
      l_output varchar2(4000);
      l_status number;
    BEGIN
      l_cursor := dbms_sql.open_cursor;
      dbms_sql.parse(l_cursor, 'SELECT * FROM Dual WHERE Dummy = :x', dbms_sql.native);
      dbms_sql.bind_variable(l_cursor, ':x', p_input);
      dbms_sql.define_column(l_cursor, 1, l_output, 4000);
      l_status := dbms_sql.execute(l_cursor);
      if(dbms_sql.fetch_rows(l_cursor) <= 0)
      then
        l_output := null;
      else
        dbms_sql.column_value(l_cursor, 1, l_output);
      end if;
    END parse_bind_execute_close;
    END DEMO_141_PKG;and the above is called here
    create or replace
    PROCEDURE QUICKFIX142 AS
    BEGIN
    -- demo.runstats_pkg.rs_start; // Don't worry about  runstats - it's a Tom Kyte package for
    -- timings and measuring contention.
      execute immediate 'alter session set session_cached_cursors = 0';
      for i in 1..1000
      loop
        DEMO_141_PKG.parse_bind_execute_close('Y');
      end loop;
    -- runstats_pkg.rs_middle;
      execute immediate 'alter session set session_cached_cursors = 100';  // reduced this to 50, 20, 10 & 5 - no effect.
      for i in 1..1000
      loop
        DEMO_141_PKG.parse_bind_execute_close('Y');
      end loop;
    -- runstats_pkg.rs_stop;
    END QUICKFIX142;Edited by: Paulie on Aug 12, 2011 2:18 PM

    If you modify the called package by adding :
      -- CLOSE THE CURSOR
      dbms_sql.close_cursor(l_cursor);in
    procedure parse_bind_execute_close(p_input in varchar2)
    AS
      l_cursor number;
      l_output varchar2(4000);
      l_status number;
    BEGIN
      l_cursor := dbms_sql.open_cursor;
      dbms_sql.parse(l_cursor, 'SELECT * FROM Dual WHERE Dummy = :x', dbms_sql.native);
      dbms_sql.bind_variable(l_cursor, ':x', p_input);
      dbms_sql.define_column(l_cursor, 1, l_output, 4000);
      l_status := dbms_sql.execute(l_cursor);
      if(dbms_sql.fetch_rows(l_cursor) <= 0)
      then
        l_output := null;
      else
        dbms_sql.column_value(l_cursor, 1, l_output);
      end if;
      -- CLOSE THE CURSOR
      dbms_sql.close_cursor(l_cursor);
    END parse_bind_execute_close;
    END DEMO_141_PKG;Then script runs with default OPEN_CURSORS setting:
    SQL> connect / as sysdba
    Connected.
    SQL> show parameter open_c
    NAME                                 TYPE        VALUE
    open_cursors                         integer     300
    SQL> connect test/test
    Connected.
    SQL> exec quickfix142;
    PL/SQL procedure successfully completed.

  • Tom Kyte -v- Oracle Documentation - Character Semantics for AL32UTF8 ?

    On a unicode database, what is best practice for varchar columns - character semantics or byte semantics ?
    Tom Kyte's new book Expert Oracle Database Architecture says "When using a multibyte character set such as UTF8, you would be well advised to use the CHAR modifier in the VARCHAR2/CHAR definition - that is, use VARCHAR2(80 CHAR), not VARCHAR2(80), since your intention is likely to define a column that can in fact store 80 characters of data." (p499). This I would agree with.
    Yet, when I read the 10gR2 documentation "Globalization Support Guide", it says "The BYTE and CHAR qualifiers shown in the VARCHAR2 definitions should be avoided when possible because they lead to mixed-semantics databases. Instead, set NLS_LENGTH_SEMANTICS in the initialization parameter file and define column datatypes to use the default semantics based on the value of NLS_LENGTH_SEMANTICS. Byte semantics is the default for the database character set."
    I'd much rather explicitly state that I'm using character semantics, than relying on some default setting. So who's right ? Tom Kyte, or the Oracle documentation ? Or are they saying different things ?
    If I use character semantics, is this going to come back and bite me later ?
    I'm using Oracle 10gR2, and the database character set is the default of AL32UTF8, using only VARCHAR columns - not NVARCHAR.
    Thanks,
    Andy Mackie

    I would say that both want to say the same thing in a different way.
    Whether you always specify CHAR modifier or define NLS_LENGTH_SEMANTICS to CHAR is the same ... until you decide to change NLS_LENTGH_SEMANTICS to BYTE but this change will only apply to new columns created after NLS_LENGTH_SEMANTICS parameter change and I wonder why you would to do it.
    You have to use character semantics and make a choice: if you don't need to change it, it should not bite you back.

  • How do I convert the old sync key (12 characters, no dashes) to the new sync key (31 characters, 5 dashes)?

    My sync key used to be 12 characters, no dashes (xxxxxxxxxxxx). After uninstalling and reinstalling FF 3.6.13, Sync 1.6.1 refuses my 12 character sync key.
    I discovered, that sync keys for all users have been switched to 31 characters including 5 dashes (x-xxxxx-xxxxx-xxxxx-xxxxx-xxxxx). How do I get the new sync key?
    I have no PCs connected to Firefox Sync anymore but Firefox Home and 360 Browser on my iPhone sync successfully. Unfortunately on the iPhone I cannot display the currently used sync key. Is there a way to convert the old sync key to the new one?
    I need the bookmarks saved in my Sync account.
    Thanks for your help!

    I had the exact same symptoms you did. Here's my solution:
    I installed an older version of firefox sync (1.4.something, I think) and then added my account using my old short firefox sync key. When trying to sync, the outdated addon said that in order to perform the sync, it needed to be updated. After updating, I was still signed in, but now had the added feature of seeing my new long firefox sync key which was compatible with FF 4b, etc. Everything is working smoothly now and my computer is syncing correctly.

  • Converting/capturing old analogue tapes to digital

    Can someone please outline the options and best way to convert my old tapes to digital. I have a new digital video camera and no longer use the old 8mm camera so I would like to convert the old video to digital so I can edit it and generally maintain it all in the same format, we never get to watch the old stuff. I asssume I can't use the digital camera unless it has a video-in port. Otherwise there seems to be a wide range of USB analgue to digital video converters on the market that are fairly inexpensive...do they work?
    Thanks...any advice would be appreciated.

    I am using the EyeTV Hybrid from ElGato. It works great for VHS. It should work for you too if your analog camcorder has either RCA jacks out (red, white, yellow) or coax cable out.
    You first capture the video from analog to Mpeg2 using the EyeTV hybrid. Then you export from EyeTV in DV format so that iMovie can edit it.

  • I converted my old 3G to an iPod but am unable to get Playlists to auto repeat. Any ideas would be helpful.

    Using old iPhones for ipods
    I converted my old 3G to an iPod but am unable to get Playlists to auto repeat. Any ideas would be helpful.

    select use as new phone if you want it blanked out.... and select restore from backup if you want it to go back to a previous state.
    with the original sim that was in there it will eventually drop the "waiting for activation" messages and will just say No Service... at least thats what mine did

  • Volvo s80 2008 model works with iPhone 5 only on hands free mode. Should it not also play my music through Bluetooth connection. Even my 4 year old Tom Tom does that.

    How do I get iPhone 5 to stream music by Bluetooth to my volvo s80. My built in volvo Bluetooth seems only to pair for calls and address book only but I can't get it to stream the music. Surly this should be possible my 4 year old Tom Tom even does that.

    If bound to a Bluetooth device which support a2dp all audio Will play out of the Bluetooth device this have been the case with all iOS devices which support Bluetooth

  • How do I convert an old iphone to an ipod?

    Hi,
    I recently got a new iphone 5 and want to convert my old iphone 3gs into an ipod for my kids.  I've restored the settings but I still have No Service.  Any advice on how to fix this?  Thanks!

    If you when you say you still have No Service you are referring to the cellular connection on your old iPhone 3gs you shouldn't have one if you are trying to use it as just an iPod.  I suspect either you removed the Sim or the Sim is inactive.  Beware that most cell phones even though the Sim is removed or is inactive will still make emergency calls.

  • How do i download InDesign CS6 in order to convert my old pagemaker?

    I used to have Adobe Pagemaker and have one important document that I update each year for publication here in our synagogue yet once I got a new pc, we didn't have the disc to reinstall that program and I can no longer access it. I have downloaded the free 30 day trial for Adboe InDesign but am not sure what I need to do now in order to convert the old pmd format to a usable format. Help?!?!

    Re: PageMaker to In-Design

  • Straight SQL query results are considerably faster than a FUNCTION...

    Hey all,
    First time new poster, long time reader.
    I have a function that calls a specific query with 2 variables. When I execute the query and hardcode the values, it executes <strong>much </strong>quicker than when the function is called, and the values are passed. I'll give some examples below... here's the full function:
    FUNCTION get_golf_gameplay_completed (
    p_cabinet_id_in NUMBER,
    p_days_back_in NUMBER
    RETURN ref_cursor
    IS
    cu_ref_cur ref_cursor;
    BEGIN
    OPEN cu_ref_cur FOR
    SELECT golf_game_data.cabinet_id, golf_game_data.player_num,
    TO_CHAR
    (global_utility_pkg.cnvrt_gmt_to_local_time_by_cab
    (golf_game_data.cabinet_id,
    golf_game_data.server_start_time,
    golf_game_data.server_start_time
    'MM/DD/YYYY HH:MI:SS AM'
    ) cab_local_event_timestamp,
    TO_CHAR
    (global_utility_pkg.cnvrt_gmt_to_local_time_by_cab
    (golf_game_data.cabinet_id,
    golf_game_data_end_time.server_end_time,
    golf_game_data_end_time.server_end_time
    'MM/DD/YYYY HH:MI:SS AM'
    ) cab_local_session_end,
    TO_CHAR
    (global_utility_pkg.cnvrt_gmt_to_local_time_by_cab
    (golf_game_data.cabinet_id,
    golf_game_data_end_time.server_end_time,
    golf_game_data_end_time.server_end_time
    'HH:MI:SS AM'
    ) cab_local_session_end_time,
    TO_CHAR
    (global_utility_pkg.cnvrt_gmt_to_local_time_by_cab
    (golf_game_data.cabinet_id,
    golf_game_data_end_time.server_end_time,
    golf_game_data_end_time.server_end_time
    'MM/DD/YYYY'
    ) cab_local_server_end_date
    FROM golf_game_data INNER JOIN golf_game_data_end_time
    ON golf_game_data.cabinet_id =
    golf_game_data_end_time.cabinet_id
    AND golf_game_data.player_num =
    golf_game_data_end_time.player_num
    AND golf_game_data.session_id =
    golf_game_data_end_time.session_id
    WHERE golf_game_data.cabinet_id = {color:#ff0000}<strong>p_cabinet_id_in</strong>{color}
    AND golf_game_data_end_time.cabinet_id = {color:#ff0000}<strong>p_cabinet_id_in</strong>{color}
    AND golf_game_data_end_time.server_end_time IS NOT NULL
    AND golf_game_data.server_start_time &gt;= SYSDATE - {color:#ff0000}<strong>p_days_back_in</strong>{color}
    ORDER BY golf_game_data_end_time.server_end_time;
    RETURN cu_ref_cur;
    END get_golf_gameplay_completed;
    I've highlighted the variables for readability.
    This is how I've been executing the function from the SQL*Plus command line:
    select tech_report_package.get_golf_gameplay_completed(122477,10) from dual;
    The speed differences between running the raw query versus the function as a whole have been driving me nuts. For the cabinet IDs (the first variable inserted - in the case above, it would be 122477) that have a high amount of activity on the GOLF_GAME_DATA table, the query itself returns results within a few seconds (usually under 10 seconds even for the most bloated data). However, the function, when called with the same IDs, takes minutes - as long as 3 or 4 minutes in some cases.
    I've run various tests in a cloned production environment, and we've isolated any possible issues with networking, data contention, and partitioning (the GOLF_GAME_DATA table is not partitioned) - the issue is simply the query speed versus function speed, with no external influences.
    What baffles me is the fact that the function is very basic - all it does it executes the query and returns the results, just like the query... the only difference being the cursor that's opened.
    So, getting back to square one; my question was: <u>why would any query run much quicker than a function that does nothing but call the same query?</u>
    Any thoughts?
    Thanks
    -Bob

    No change after using that parameter in the session.
    Any other ideas? I was playing with results with one of my coworkers and my manager, and we were unable to produce any results that were, well, reproducable. Even after <strong>shutting the database down</strong>, and starting it back up, it seems that the results from some of the example queries that we were running were being cached on the SAN which hosts the database's files, or cached and restored after the instance was started up.
    FYI - we test on an instance that mimics production. It's a clone that's produced once a day against the production database, and has no user contention. We bring it up, and are able to test things like we would in production with no other users on the instance at the same time. We are still seeing slow results.

  • Pl/sql function body returning SQL query - Print function

    Hello all,
    I have pl/sql function body returning SQL query for my reports for my new project that I am developing. We dont have any BI tool or anything for APEX so we use Oracle reports to get the same reports to be printed in PDF format. I had been using SQL function for Reports all these days and grabbing the data using SQL query was easy in Oracle reports. But this time we had atleast 8 fields in search criteria and hence I thouhgt PL/sql function body returning SQL query could be something easy to handle that scenario. We have 11 such reports in our project. Now when we tried to use the same PL/sql function to oracle reports , I was told by one of our Oracle reports expert, that we have to write it into functions and use it in SQL query to get the Reports in Oracle reports. Is there any Easy way to convert the same Pl/SQL function or get a PDF format of the same report in APEX without going thru the much pains of rewriting the whole SQL Query.
    thank you
    Devisri

    Hi,
    give this a go.
    I can't test it as I don't have the tables in my schema.
    create or replace package MK_TEST_PF is
    -- Author  : MK
    -- Created : 21/06/2010 16:30:19
    -- Purpose : FOR LUCY_DISCOVER
    -- Public type declarations
    /*     -- just guess the table row types.....
         -- otherwise it won't compile
         type test_rec is record
              (INV REP.inv%type
              ,cNUMBER REP.cNUMBER%type
              ,OPENDATE REP.OPENDATE%type
              ,TARGETDATE REP.ESTCOMPLETE%type
              ,DATECLOSED REP.COMPLETED%type
              ,STATUS REP.STATUS%type
              ,cCODE REP.cCODE%type
              ,line varchar2(4000)
              ,SIGc varchar2(4000)
              ,CLASS REP.CLASS%type
              ,SUMM REP.SUMM%type
              ,AREA REP.AREA%type
         type test_rec is record
              (INV varchar2(4000)
              ,cNUMBER varchar2(4000)
              ,OPENDATE varchar2(4000)
              ,TARGETDATE varchar2(4000)
              ,DATECLOSED varchar2(4000)
              ,STATUS varchar2(4000)
              ,cCODE varchar2(4000)
              ,line varchar2(4000)
              ,SIGc varchar2(4000)
              ,CLASS varchar2(4000)
              ,SUMM varchar2(4000)
              ,AREA varchar2(4000)
         type test_tab is table of test_rec;
    -- Public constant declarations
    -- Public variable declarations
    -- Public function and procedure declarations
    end MK_TEST_PF;
    create or replace package body MK_TEST_PF is
    -- Private type declarations
    -- Private constant declarations
    -- Private variable declarations
    -- Function and procedure implementations
         function get_query_f
              (p_inv VARCHAR2 := UPPER(v('P44_INV'))
              ,p_reg VARCHAR2 := UPPER(v('P44_CLASS'))
              ,p_proarea VARCHAR2 := UPPER(v('P44_PROGRAM_AREA'))
              ,p_disp VARCHAR2 := UPPER(v('P44_DISPOSITION'))
              ,p_coding VARCHAR2 := UPPER(v('P44_CODING'))
              ,p_status VARCHAR2 := UPPER(v('P44_STATUS'))
              ,p_SIG VARCHAR2 := UPPER(v('P44_SIG_c'))
              ,p_inc_sum VARCHAR2 := UPPER(v('P44_INCLUDE_SUMM_FIELD'))
              ,p_word VARCHAR2 := UPPER(v('P44_WORD_IN_SUMM'))
              ,p_timeframe VARCHAR2 := UPPER(v('P44_TIME_FRAME'))
              ,p_rec VARCHAR2 := UPPER(v('P44_RECORD_KEEPING'))
              ,p_WORD_IN_SUMM VARCHAR2 := UPPER(v('P44_WORD_IN_SUMM'))
              ,p_ON_AFTER VARCHAR2 := UPPER(v('P44_ON_AFTER'))
              ,p_ON_BEFORE VARCHAR2 := UPPER(v('P44_ON_BEFORE'))
              return varchar2
         is
              v_sql VARCHAR2(5000);
         --     v_inv VARCHAR2(100);
         --     v_reg VARCHAR2(100);
         --     v_proarea VARCHAR2(100);
         --     v_status VARCHAR2(100);
         --     v_SIG VARCHAR2(100);
         --     v_disp VARCHAR2(100);
         --     v_coding VARCHAR2(100);
         --     v_inc_sum VARCHAR2(4);
         --     v_word VARCHAR2(4000);
              v_wildcard VARCHAR2(2000);
         --     v_timeframe VARCHAR2(100);
         --     v_rec VARCHAR2(5);
              v_record VARCHAR2(5);
              v_open VARCHAR2(100);
              v_closed VARCHAR2(100);
              v_PEND VARCHAR2(100);
              v_refSIG VARCHAR2(100);
              v_refreg VARCHAR2(100);
              v_refother VARCHAR2(100);
              v_y varchar2(100);
         BEGIN
              --v_inv := UPPER(v('P44_INV')) ;
              v_record := 'R%';
              v_wildcard := '%';
              v_open := 'OPEN';
              v_closed := 'CLOSED';
              v_PEND := 'PEND';
              v_refSIG := 'REF - SIG';
              v_refreg := 'REF - CLASS';
              v_refother := 'REF - OTHER';
              v_y := 'Y';
              v_sql := 'SELECT REP.INV as INV, REP.cNUMBER as cNUMBER, REP.OPENDATE as OPENDATE,
              REP.ESTCOMPLETE as TARGETDATE, REP.COMPLETED as DATECLOSED, REP.STATUS as STATUS,
              REP.cCODE as cCODE, apex_item.checkbox(1,REP.line,null,'''||v_y||''') line , apex_item.checkbox(1,REP.SIG,null,'''||v_y||''') SIGc ,
              REP.CLASS as CLASS, REP.SUMM as SUMM, REP.AREA as AREA from REP where 1=1';
              IF p_rec is not null then
                   IF p_rec = 'E' then
                        v_sql := v_sql|| ' and upper(REP.cnumber) not like '''||v_record||'''';
                   ELSIF p_rec = 'D' then
                        v_sql := v_sql|| ' and upper(REP.cnumber) like '''||v_record||'''';
                   ELSIF p_rec = 'I' then
                        v_sql := v_sql|| ' and REP.cnumber = REP.cnumber ';
                   end if ;
              end if ;
              IF upper(p_status) not like '%NULL%' then
                   IF upper(p_status) like '%OPEN%' then
                   v_sql := v_sql||' AND upper(REP.status) like '''||v_open||'''';
                   ELSIF upper(p_status) like '%CLOSED%' then
                   v_sql := v_sql||' AND upper(REP.status) like '''||v_closed||'''';
                   ELSIF upper(v_PEND) like '%PEND%' then
                   v_sql := v_sql||' AND upper(REP.status) like '''||v_PEND||'''';
                   ELSIF upper(v_refSIG) like '%REF - SIG%' then
                   v_sql := v_sql||' AND upper(REP.status) like '''||v_refSIG||'''';
                   ELSIF upper(v_refreg) like '%REF - CLASS%' then
                   v_sql := v_sql||' AND upper(REP.status) like '''||v_refreg||'''';
                   ELSIF upper(v_refother) like '%REF - OTHER%' then
                   v_sql := v_sql||' AND upper(REP.status) like '''||v_refother||'''';
                   END IF ;
              END IF ;
              IF p_inv = 'NULL' THEN
                   v_sql := v_sql||' AND instr(upper(REP.INV),'''||p_inv||''') > 0';
              END IF ;
              IF p_reg = 'NULL' THEN
                   v_sql := v_sql||' AND instr(upper(REP.CLASS),'''||p_reg||''') > 0';
              END IF ;
              IF p_proarea = 'NULL' THEN
                   v_sql := v_sql||' AND instr(upper(REP.AREA),'''||p_proarea||''') > 0';
              END IF ;
              IF p_disp = 'NULL' THEN
                   v_sql := v_sql||' AND instr(upper(REP.disposition),'''||p_disp||''') > 0';
              END IF ;
              IF p_coding = 'NULL' THEN
                   v_sql := v_sql||' AND instr(upper(REP.ccode),'''||p_coding||''') > 0';
              END IF ;
              IF p_SIG = ' ' THEN
                   v_sql := v_sql||' AND instr(upper(REP.SIG),'''||p_SIG||''') > 0';
              END IF ;
              IF p_word is not null then
                   v_sql := v_sql|| ' and
                   instr(upper(REP.SUMM),
                   upper(nvl('''||p_WORD_IN_SUMM||''',REP.SUMM))) > 0';
              end if ;
              If p_timeframe is not null then
                   if upper(p_timeframe) = 'OPEN' then
                   v_sql := v_sql|| ' and to_date(REP.opendate) between to_date ('''||p_ON_AFTER||''') and to_date('''||p_ON_BEFORE||''')';
                   elsif upper(p_timeframe) = 'CLOSED' then
                   v_sql := v_sql|| ' and to_date(REP.completed) between to_date ('''||p_ON_AFTER||''') and to_date('''||p_ON_BEFORE||''')';
                   elsif upper(p_timeframe) = 'EST' then
                   v_sql := v_sql|| ' and to_date(REP.estcomplete) between to_date ('''||p_ON_AFTER||''') and to_date('''||p_ON_BEFORE||''')';
                   end if;
              end if;
              v_sql := v_sql ||' order by REP.INV ';
              return v_sql;
         end get_query_f;
         function test_pf
              (p_inv VARCHAR2 := UPPER(v('P44_INV'))
              ,p_reg VARCHAR2 := UPPER(v('P44_CLASS'))
              ,p_proarea VARCHAR2 := UPPER(v('P44_PROGRAM_AREA'))
              ,p_disp VARCHAR2 := UPPER(v('P44_DISPOSITION'))
              ,p_coding VARCHAR2 := UPPER(v('P44_CODING'))
              ,p_status VARCHAR2 := UPPER(v('P44_STATUS'))
              ,p_SIG VARCHAR2 := UPPER(v('P44_SIG_c'))
              ,p_inc_sum VARCHAR2 := UPPER(v('P44_INCLUDE_SUMM_FIELD'))
              ,p_word VARCHAR2 := UPPER(v('P44_WORD_IN_SUMM'))
              ,p_timeframe VARCHAR2 := UPPER(v('P44_TIME_FRAME'))
              ,p_rec VARCHAR2 := UPPER(v('P44_RECORD_KEEPING'))
              ,p_WORD_IN_SUMM VARCHAR2 := UPPER(v('P44_WORD_IN_SUMM'))
              ,p_ON_AFTER VARCHAR2 := UPPER(v('P44_ON_AFTER'))
              ,p_ON_BEFORE VARCHAR2 := UPPER(v('P44_ON_BEFORE'))
              RETURN test_tab PIPELINED
         is
              type test_c is ref cursor;
              v_row test_tab;
              v_sql varchar2(4000);
              v_cursor test_c;
         begin
              v_sql := get_query_f
                   (p_inv
                   ,p_reg
                   ,p_proarea
                   ,p_disp
                   ,p_coding
                   ,p_status
                   ,p_SIG
                   ,p_inc_sum
                   ,p_word
                   ,p_timeframe
                   ,p_rec
                   ,p_WORD_IN_SUMM
                   ,p_ON_AFTER
                   ,p_ON_BEFORE
              open v_cursor for v_sql;
              fetch v_cursor bulk collect into v_row;
              close v_cursor;
              for i in 1 .. v_row.count loop
                   pipe row (v_row(i));
              end loop;
              return;
         end test_pf;
    end MK_TEST_PF;
    /Regards
    Michael

Maybe you are looking for