Body of function from PL/SQL query SQL - problem with where Cluase return

Hi all
I have problem with sub PL/SQL. Where clause does not filter the values even when I change the value: P7_INVESTIGATOR. I have marked with an asterisk for where clause where I want the values to filtered.


DECLARE
v_sql varchar2 (5000);
v_inv VARCHAR2 (100);

Start
v_inv: = UPPER(:P7_INVESTIGATOR);

v_sql: = ' select TBLCASES. INVESTIGATOR as an INVESTIGATOR,';
v_sql: = v_sql | "TBLCASES. CASENUMBER as CASENUMBER,';
v_sql: = v_sql | "TBLCASES. OPENDATE as OPENDATE,';
v_sql: = v_sql | "TBLCASES. ESTCOMPLETE as DATE_CIBLE,';
v_sql: = v_sql | "TBLCASES. STATUS of STATUS ';
v_sql: = v_sql | "TBLCASES. Case CODE case CODE as,';
v_sql: = V_sql | "TBLCASES. FAIR_HOTLINE as FAIRHotline,';
v_sql: = v_sql | "TBLCASES. NYSIG as NYSIGCase,';
v_sql: = v_sql | "TBLCASES. The REGION';
v_sql: = v_sql | "TBLCASES. PROGAREA as PROGArea ';
v_sql: = v_sql | ' from TBLCASES where 1 = 1';
**************************************************************
If v_inv <>null then
v_sql
: = v_sql | "and UPPER (trim (tblcases.investigator)) = UPPER (trim (v_inv))';
END IF;
***************************************************************
v_sql: = v_sql | "order by tblcases.investigator";
Return v_sql;
end;


Thank you

wrote:
Or it is possible to write it this way:

if v_inv is not null then
v_sql := v_sql ||'  and UPPER(trim(tblcases.investigator)) = UPPER(trim(:P7_INVESTIGATOR))';
END IF ;

In this case we will use bind variables and we all know that it is very important.

Lev

Of cause, it is the best option. and I strongly suggest the OP to use.
But it depends on how the sql is used later.
Without knowing that, we cannot be sure if the item is available here.

Tags: Database

Similar Questions

  • Export as .xls. Classic report type: SQL (body of function from PL/SQL returning the SQL) query

    Hey guys,.

    I'm using version 4.2.6 apex. The theme is 26.

    IM also using Listener Oracle APEX.

    I can print my classic report in PDF or CSV format.

    But I need to export it as a .xls extension.

    Report type: SQL (body of function from PL/SQL returning the SQL) query

    I need is like this cause my 'where' clause type is dynamic.

    Look at using this method: Tom's Blog: a non-standard export excel 2010 (.xlsx)

    I do something similar for downloads to excel in my projects...

    Thank you

    Tony Miller
    Software LuvMuffin
    Ruckersville, WILL

  • SQL (body of function from PL/SQL returning the SQL) query when you use to_char

    We are trying to build a page of Type SQL Query report (body of function from PL/SQL returning SQL query).
    our request is simple, to extract the month of the column recording_date.

    declare
    l_query varchar2 (1000);
    Start
    l_query: = 'select to_char (recording_date, 'MM') of re_productive;
    Return l_query;
    end;

    but we would like the following for this query problem

    Function returning SQL query: query cannot be parsed in the generator. If you believe that your query is syntactically correct, check the box of generic columns below the source of the region without analysis.
    (ORA-06550: line 4, column 42: PLS-00103: encountered the symbol "MY" what awaits one of the following values:.) (* @ % & = - +; <>/ at is mod remains not rem <>or! = or ~ = > = < = <>and or as between | multiset Member SUBMULTISET_ the symbol ".") was inserted before 'MY' to continue.)

    Notes:
    1 - the request is correct and it has been tested under sqlplus and toad.
    2. we tried option use generic name (analysis of query runtime only) column, but we get the same problem.


    any quick help please.

    Hello

    You have not escaped your quote in the string. Try this...

    DECLARE
    l_query VARCHAR2(32767);
    
    BEGIN
    
    l_query:= 'select to_char(recording_date,''MM'') from re_productive';
    
    RETURN l_query;
    
    END;
    

    See you soon

    Ben

  • I can't see a message from my Union because of problems with the address changed for pop-upwindows and some other issues

    Hello
    I am from Sweden and I have problems with a Web site that has my Union. I could see messages from them before, but they changed their address and on the site, they say people that they must put the new address on the approved list of the pop-up windows. I did but it still does not. Maybe I did wrong, I don't know, but it's annoying as hell that I can't see the messages they send.

    I really need help with that.

    Best regards
    Lena

    You can control and manage permissions for all areas on the Subject: authorizations page.

    You can delete all data stored in Firefox with a specific area through "Forget this Site" from the context menu of the history entry (see the history or the history sidebar) or via the subject: permissions page.

    Using "Forget this Site" will delete all data stored in Firefox in this area as bookmarks, cookies, words of past, cache, history, and exceptions, so be careful and if you have a password or other data from this area you don't want to lose so take note of these passwords and bookmarks.
    You can't recover from which "forget" unless you have a backup of the affected files.

    It has no lasting effect, so if come back you on such a 'forgotten' site, then the data of this Web site will be saved once more.

  • How to the return type of function from PL/SQL

    Hello

    I need to create a function that returns a list of ID, which is stored in a type T_IDs, something like:

    search function (searchstring in varchar2) return to T_IDs

    I have a little problem with the type within the body of the function using a select statement and filling

    Select the id of the table where the text as searchstring.

    which is to select a list of IDS corresponding to the where clause. Is it possible to use select in or should I go for another mechanism?

    Thanks for all the ideas.

    Bulk Collect works for me...

    SQL> create type t_ids as table of number;
      2  /
    
    Type created.
    
    SQL> ed
    Wrote file afiedt.buf
    
      1  create or replace function get_ids(deptno in number) return t_ids is
      2    ids t_ids;
      3  begin
      4    select empno
      5    bulk collect into ids
      6    from   emp
      7    where  deptno = get_ids.deptno;
      8    return ids;
      9* end;
    SQL> /
    
    Function created.
    
    SQL> select * from table(get_ids(10));
    
    COLUMN_VALUE
    ------------
            7782
            7839
            7934
    

    However, I would rarely use such a data collection, as it fills with PGA in memory and passing a lot of data between SQL and PL/SQL. I must have a just cause and justified in wanting to do things this way.

  • Irregular data loss - function from PL/SQL returning data using Ref Cursor

    Database Version: 10.2.0.4.0 (node 2 CARS)

    The high-level process flow is as below:
    (1) insert records in a few tables & commit the same
    (2) call the pl/sql function to extract files (on certain conditions with joins with other tables) of the tables which are filled in step 1.
    -> It uses the ORDER BY clause to queries inline & line number 5000 records return for each call.
    Sense - if inline query is supposed to return 1,00,000 records then 20 calls to the same function. This, because the application cannot contain records beyond number.
    (3) the data returned by the ref cursor is then processed by application (Tibco BW) to generate the flat file.

    We are facing the problem of data loss in the file and there is no fixed model. It happens once between 200-300 calls process.
    Resolution: When the problem occurs, triggering the process and in almost every time re-outbreak of the process provides required data.

    Guidance on what could be the reason?

    * Examples of Code for the function:
    CREATE OR REPLACE FUNCTION FUNC_GET_HRCH_TOTAL_DATA)
    outinstrid in NUMBERS
    outinstrkey in NUMBERS
    rownumberstart in NUMBERS
    rownumbereend in NUMBERS
    err_code OUT VARCHAR2,
    err_msg OUT VARCHAR2)
    RETURN PACK_TYPES. HRCH_TOTAL_CURSOR
    IS
    REF_HRCH_TOTAL_CURSOR PACK_TYPES. HRCH_TOTAL_CURSOR;
    BEGIN

    OPEN FOR REF_HRCH_TOTAL_CURSOR
    SELECT *.
    FROM (SELECT A.HIERARCHY_KEY, B.KEY, B.VAL_KEY, A.KEY_NEW, C.ITEMID, B.VAL_TAG, B.sort_order, ROWNUM ROWNUMBER
    OF AOD_HRCH_ITEM A, AOD_HRCH_ATTR B, AOD_HRCH_ITEMS C
    WHERE A.outputid = B.outputid
    AND A.outputid = C.outputid AND A.outputkey = B.outputkey
    AND A.outputkey = C.outputkey AND A.outputid = outinstrid
    AND A.outputkey = outinstrkey AND A.ITEM_SEQ = B.ITEM_SEQ
    AND A.ITEM_SEQ = C.ITEM_SEQ AND A.HIERARCHY_LEVEL_ORDER = B.SORT_ORDER
    ORDER BY A.HIERARCHY_LEVEL_ORDER DESC)
    WHERE ROWNUMBER < rownumbereend
    AND ROWNUMBER > = rownumberstart;


    RETURN REF_HRCH_TOTAL_CURSOR;
    EXCEPTION
    WHILE OTHERS
    THEN
    err_code: = x_progress | ' - ' || SQLCODE;
    err_msg: = SUBSTR (SQLERRM, 1, 500);

    END FUNC_GET_HRCH_TOTAL_DATA;
    /

    Published by: meet_sanc on February 16, 2013 10:42

    Your SELECT statement is almost certainly incorrect

    SELECT *
      FROM ( SELECT A.HIERARCHY_KEY, B.KEY, B.VAL_KEY, A.KEY_NEW, C.ITEMID, B.VAL_TAG, B.sort_order,ROWNUM ROWNUMBER
               FROM AOD_HRCH_ITEM A, AOD_HRCH_ATTR B, AOD_HRCH_ITEMS C
              WHERE A.outputid = B.outputid
                AND A.outputid = C.outputid AND A.outputkey = B.outputkey
                AND A.outputkey = C.outputkey AND A.outputid = outinstrid
                AND A.outputkey = outinstrkey AND A.ITEM_SEQ = B.ITEM_SEQ
                AND A.ITEM_SEQ = C.ITEM_SEQ AND A.HIERARCHY_LEVEL_ORDER = B.SORT_ORDER
              ORDER BY A.HIERARCHY_LEVEL_ORDER DESC)
     WHERE ROWNUMBER < rownumbereend
       AND ROWNUMBER >= rownumberstart;
    

    Since the ORDER BY is applied after the ROWNUM is assigned in this case, your query is requested for a period of 5000 lines any arbitrariness. It would be perfectly valid for a single line to return in each of your 200 different calls or for a line to return in any of them.

    You definitely want to do something in the sense of the canonical askTom wire

    select *
      from ( select a.*, rownum rnum
               from ( YOUR_QUERY_GOES_HERE -- including the order by ) a
              where rownum <= MAX_ROWS )
     where rnum >= MIN_ROWS
    

    That said, it seems inconceivable that Tibco is unable to manage a cursor that returns more than a certain number of lines. You do a ton of work to return the data pages that are certainly not necessary. Unless you're saying that you somehow paralyzed your installation of Tibco giving him a ridiculously small amount of memory to process, something doesn't look good. A slider is just a pointer - it holds that no data - so the number of lines that you can extract a slider should have no impact on the amount of memory on the client application needs.

    As others have already pointed out, your exception handler is almost certainly do more harm than good. Return the error codes and error messages as from the OUT parameters, instead of simply allowing the exception to propagate deletes a ton of useful information (such as the mistake of the stack) and makes your process much less robust.

    Justin

  • How can I get a value from a function from pl/sql by OADBTransaction

    Hi all
    Hope you will be fine.
    as we know, we can get a sequence by this code value:
    Super.Create (AttributeList);
    Transaction OADBTransaction = getOADBTransaction();

    Vendor ID is obtained from the table sequence
    Number supplierId = transaction.getSequenceValue ("FWK_TBX_SUPPLIERS_S");

    My question is how can I get a value in a variable to a pl/sql function:
    the function is defined as follows:
    ******
    create or replace function getNextTrans return varchar2
    is
    Team varchar2 (20);
    Start
    SELECT "CASH". TO_CHAR (SYSDATE, 'DDMMYYYY') | GP_CASH_TRX_SEQ. NEXTVAL FROM DUAL;
    return team;
    end;
    /

    Hey Dina,

    Reference http://www.oraclearea51.com/oracle-technical-articles/oa-framework/229-calling-database-procedures-and-function-from-oaf.html

    Kind regards
    GYAN

  • Authorisation scheme: poll from function from PL/SQL Boolean value

    Hello
    I use with authorisation schemes on page 2 as function of PL/SQL to return a Boolean.

    The value of P1_PREF is from page1 (search) report box, driven model type (< class td = "t12data" >#PREF # < table >)

    --(lien hypertexte pref) to page 2 P2_PREF.

    I tried passing the value (: P2_PREF or: P1_PREF) but it does not work. If I assign (where pref = "100") or any other value it works fine.
    Is it to do with sessions or to store the value in a variable prior to authorization of the page. Please notify.

    DECLARE
    v_userrole VARCHAR2 (400) DEFAULT NULL;
    v_staffaccess VARCHAR2 (400) DEFAULT NULL;
    BEGIN

    Select USER_ROLE IN v_userrole
    to userrole
    where (upper (USER_LOGIN) = upper(:APP_USER)
    or (upper (:APP_USER)) = 'TEST');

    Select staff_access in the v_staffaccess of sm
    where pref = "P2_PREF";

    IF INSTR (v_userrole, 'A') > 0
    THEN
    RETURN TRUE;
    END IF;

    IF (((v_userrole) = "SP" OR (v_userrole) = 'U') and nvl (upper (v_staffaccess), 'x') do not ("SUPER %')) THEN)
    RETURN TRUE;
    ELSE RETURN FALSE;
    END IF;

    END;

    Please advise on the passage of the value.
    Thank you very much
    Harinder

    Hi Harinder

    There are many ways this can be achieved. It seems to me that your problem is that the value passed to page 2 is not be updated at each visit?

    So how about this (as only one way to do it).

    Page 1 to P1_PREF
    You press a button or link to go to page 2, that SUPPORTS THE PAGE (important)
    You have a hidden item P2_PREF on page2, who has...

    Source used - always replace any existing value in session state
    Source - point Type

    And then refer to P1_PREF.

    Or you can create a calculation that sets the value of P2_PREF to the value of P2_PREF on the laundry front header.

    Or your button on page 1 could create a branch to page 2 using "defined these elements" "with these values" options in the industry...

    See you soon

    Ben

  • How to operate my function from PL/SQL?

    I have 4 table

    1st is EMPLOYEE (E #, ENAME), the primary key is E #.

    2nd is DRIVER(E#,L#), the primary key is E # ID EMPLOYEE

    3. is TRIP(T#,L#), the primary key is T #, foreign key L # driver

    4th is the primary key TRIPPT(T#,PT#) T # travel

    I create a function that finds the length (total number of pt #) of the longest point to the driver
    create or replace function LONGPT (DL# in TRIP.L#%type)
       return TRIPPT.PT#%type
    IS
       TRIPPT#   TRIPPT.PT#%type;
    begin
       select max (PT#)
         into TRIPPT# 
         from TRIPPT
        where T# in (select T#
                       from TRIP
                      where L# = DL#);
    
       return nvl (TRIPPT#, 0);
    end LONGPT;
    / 
    How can I do a select query to view the employee NAME, LONGPT. The name of the driver that perform no trigger point must be in the application as well.

    I try
     
    SELECT DRIVER.L# AS License_No, LONGTPT(TRIP.L#) AS "LONGEST POINT" 
    FROM DRIVER 
       LEFT OUTER JOIN TRIP on DRIVER.L# = TRIP.L#;
    This only query the L# and the LONGEST Point.
    Could someone guide me how to do select on screen the ENAME and with my LONGPT function.

    Published by: user4757127 on November 25, 2012 10:11

    Published by: user4757127 on November 25, 2012 10:17

    Published by: user4757127 on November 25, 2012 10:18

    Hello

    Welcome to the forum!

    user4757127 wrote:
    ... How can I do a select query to view the employee NAME, LONGPT. The name of the driver that perform no trigger point must be in the application as well.

    I don't know what you mean by "the employee, LONGPT.

    My best guess is that you need join the employee table in your current query:

    SELECT  driver.l#          AS License_No
    ,     employee.ename                              -- *****  NEW  *****
    ,     longtpt (trip.l#)      AS "LONGEST POINT"
    FROM           driver
    JOIN          employee     ON   driver.e#     = employee.e#     -- *****  NEW  *****
    LEFT OUTER JOIN trip          ON   driver.l#     = trip.l#
    ;
    

    Again, this is just a guess and guess isn't always the best way to solve problems.

    I hope that answers your question.
    If not, post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and the results desired from these data.
    Explain, using specific examples, how you get these results from these data.
    Always say what version of Oracle you are using (for example, 11.2.0.2.0).
    See the FAQ forum {message identifier: = 9360002}

  • Impossible to retrieve the return value of function from pl/sql using the DB adapter

    Dear Experts,

    I use the DB adapter in my BPEL process. Using the DB adapter I invoke a PL / SQL function. I am able to send two input parameters for the pl/sql function. But I do not know how to retrieve the return value of the function. Please suggest me.

    Thank you
    Rajesh

    Can you tell how pl/sql function looks like you? you return the value of the function, right?

  • IPSEC VPN from Site to Site - NAT problem with address management

    Hi all

    I have two Cisco ASA 5505 performing of IPSEC Site to Site VPN. All traffic inside each firewall through the VPN tunnel and I have full connectivity. From site A, I can connect to the inside address of the ASA at the site B and launch of the ASDM or SSH, etc.

    The problem I have is when I'm logged on the ASA site B management traffic is given the external address. I created this as interesting traffic to get it to go through the VPN but I need to use the inside address of ASA B. The following is possible:

    • If I can make the ASA Site B to use inside interface as its address management (I already have management access to the inside Interface)
    • I have NAT can address external interfaces to Site B before moving through the VPN tunnel management traffic so that it appears to come from Site B inside the address
    • I can NAT VPN traffic as it appears in the Site A for management traffic to Site B on the right address.

    The problem is that my PRACTICE Please also come from this address and I need the application before being on an internal address to even if my CA.

    Thanks for any help.

    Ian

    Thanks, I understand what you are trying to achieve now.

    However, I think that I don't have good news for you. Unfortunately PEIE request can be initiated of the SAA within the interface, as there is no option to start the query from the inside interface. With other features of management such as AAA, logging, you have an option to specify what ASA desired originally to demand from interface, but CEP doesn't have this option.

    Here's how you can configure under the trustpoint crypto, but unfortunately by specifying the interface doesn't not part of option:

    http://www.Cisco.com/en/us/docs/security/ASA/asa84/command/reference/C5.html#wp2262210

  • ExpertDay query-overheating problem with my Pavilion DV6

    Mr President

    First of all, thank you for holding this meeting online.

    The laptop in question is only a Pavilion DV6 6121tx with product # QB367PA bought the India

    The problem is that the Palm becomes too hot after 10-15 min of use. Please note that it is not a problem with the fan/radiator because they are new and the thermal paste is also cool. CPU and GPU temperatures are quite fine and are cool.

    My doubt is what we call the PCH, which becomes too hot. JFYI, the PCH is located just below the palmrest area that becomes hot...

    Please take a look at the snapshot

    My apologies for the bad image. That's why I removed it.

    I agree with chipset problem. I think indeed that this chip is the 'problem '.

    Also, be aware that your laptop is not designed to play games.

    OK I agree that this laptop run most of the games but it will warm up as a side effect.

    However,.

    I searched for information on the PCB and the maximum temperature is...

    The PCH may not work above
    + 108 ° C.

    (Page 239)

    This is the reason why it took so long

    You can find it here. Be warned!

    This document has 900 + pages

    http://www.Intel.com/content/www/us/en/chipsets/value-chipsets/mobile-chipset-HM65.html

    http://www.Intel.com/content/dam/www/public/us/en/documents/datasheets/6-chipset-C200-chipset-datasheet.PDF

    I think it is a mistake to small design. but it's not going to kill your laptop.

    If your continuous pch to 100 for a long time, then you can leave the rest of the laptop for a while.

    Drunks.

  • Help from time to time sync problem with my 5ESXi

    Hello world

    Hope you all are doing great! Hope you can help. I did some research but I'm still confused.

    Currently, I just installed the 5ESXi on a Dell Server freeware. A host of virtual machine, I installed 2 servers vm Windows 2008R with VM Tools installed, which one of them would be the domain controller. I would ask:

    1.) how to set up the time setting for the virtual machine to Windows server? At present, the ' comments Syncronize time withhost "is not checked (which is default).

    2.) on the host of VM - Configuration - Configuration at the time of the... Should what settings I configure? Right now, I checked on "Activate" the NTP client. In OPTIONS, what options should I choose (starts automatically... Start and stop the host... Start and stop manually... etc)?

    3.) associated with #2, I would add the NTP source in Options?

    I am very concerned about the time on the server vm domain controller... and I hope that would help you in this...


    Thank you very much ahead of it.

    Takami Chiro

    Here are the best practices for time synchronization VMware...

    http://KB.VMware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalID=1318

    1.) how to set up the time setting for the virtual machine to Windows server? At present, the ' comments Syncronize time withhost "is not checked (which is default).

    You'll want to fill #2 below before enabling this option, but I would recommend going with this method of time synchronization instead of having every hour to synchronize VM with a domain controller...

    2.) on the host of VM - Configuration - Configuration at the time of the... Should what settings I configure? Right now, I checked on "Activate" the NTP client. In OPTIONS, what options should I choose (starts automatically... Start and stop the host... Start and stop manually... etc)?

    In general, I put each ESXi host to synchronize time with a domain controller.  You'll want to start and stop with the host country, but you will first need to set some time synchronization servers in the options.  You can choose dns names or IP addresses.

    3.) associated with #2, I would add the NTP source in Options?

    Yes, you must add an NTP source before you can activate start/stop with the host.

    Once you choose to synchronize time with a domain controller, I'll make sure that your domain controllers are the synchronization of time with another source of time.  You can find time servers NTP free on internet, I usually go with one of them.  Microsoft has one that you can use as well.

    Here are two sites that I have used before:

    http://www.pool.ntp.org/en/

    Time service NIST Internet

    I hope this helps...

    Ben

  • Assigning a page element in the region of the "body of function return PLSQL SQL query.

    I've not been here in a long time. I like the new forum text editor!

    I have a search page in my application that contains a return region of query SQL PLSQL function body. I use PLSQL to build a query based on the user entries in various page numbers (search text, serial number, year, etc.). Using PLSQL is very useful to enforce the page quickly because there are 1/2 million lines with a lot of text fields some of which are CLOB.

    Users want to know how many rows were returned, but if I allow using a paging system that includes the total performance dies because ApEx has to sort through all the pages of output. Instead, I use ' line varies X to Y "without the part of" Z", and it's pretty fast. I can't use the #TOTAL_ROWS # because it does not work with this system of pagination.

    So, I built a code within the region of function body PLSQL to build a second query that counts only the lines based on the input parameters. I can do this query within the region using EXECUTE IMMEDIATE and the number to an output variable. The disconnect is that I can not then assign it to a page element. If I add a statement assigned to a page element, either by

    : P45_COUNT: = p_count;
    or
    APEX_UTIL. SET_SESSION_STATE ('P45_COUNT', p_count);

    then when I submit the changes I get

    ERR-1002 unable to find point item ID 'P45_COUNT' in the application '4000 '.

    as if the ApEx is not looking for the item in my application, but in the application development environment. I am able to write the results to a table and then recover data in the next region. That's how I got around the problem, but it seems too complicated and unnecessary.

    I wrote the following code just to illustrate the problem.

    Make sense? Any ideas?

    Thank you!

    Bill


    declare
    p_sql varchar2 (32767).
    p_sql_count varchar2 (32767).
    p_table_count number (2);
    p_count number (10);
    p_instr number (10);
    Start
    p_sql: = q'! Select g.id, g.widget, g.year_made, g.serial!';
    p_sql: = p_sql | q'! g table_g where g.status = 1!';

    If: P45_YEAR_MADE is not null then
    p_sql: = p_sql | q'! and $P45_YEAR_MADE = g.year_made!';
    end if;
    If: P45_SERIAL is not null then
    p_sql: = p_sql | q'! and upper (g.serial) like '% "| Upper ($P45_SERIAL) | » %' !';
    end if;
    If: P45_WIDGET_SEARCH is not null then
    p_sql: = p_sql | q'! and upper (g.widget) like '% "| Upper ($P45_WIDGET_SEARCH) | » %' !';
    end if;

    p_instr: = instr (p_sql, 'of g table_g where g.status = 1');
    p_sql_count: = ' select count (g.id) of "| substr (p_sql, p_instr);

    p_sql_count: = replace (replace (replace (p_sql_count, ' $P45_YEAR_MADE ',: P45_YEAR_MADE), "$P45_SERIAL", "' |: P45_SERIAL |)) ('), "$P45_WIDGET_SEARCH", "' | : P45_WIDGET_SEARCH | '''');

    run immediately p_sql_count in p_count;

    / * the following

    : P45_COUNT: = p_count;

    gives this error when I submit the region in the development environment

    ERR-1002 unable to find point item ID 'P45_COUNT' in the application '4000 '.

    */

    Select count (1) in the table_sql p_table_count where app_session =: APP_SESSION.
    If p_table_count = 0 then
    insert into table_sql (app_session, sql_text, session_date, count) values (: APP_SESSION, p_sql_count, sysdate, p_count);
    on the other
    Update table_sql set sql_text = p_sql_count, session_date = sysdate, count = p_count where app_session =: APP_SESSION.
    end if;

    / * the above written SQL and count of a table * /.

    Return replace(p_sql,'$',':');
    end;

    Hello

    Try the suggestion of Scott in Re: how to get the query region "PL/SQL function body returns the query string"?

    Andy

  • Problem with hierarchical query in function PL\SQL

    I have a simple table containing the ID of the parent

    -Create table

    create the table1 table:

    (

    ID NUMBER (12) not null,

    year number 4.

    month NUMBER (2),

    parent_id NUMBER (12)

    );

    -Create/recreate primary, unique and foreign key constraints

    change the table1 table:

    Add primary key constraint PK_TABLE1 (ID);

    change the table1 table:

    Add the foreign key constraint FK_TABLE1_PARENT (PARENT_ID)

    reference TABLE1 (ID);

    data:

    Insert into TABLE1 (id, year, month, parent_id)

    values (5, 2015, 12, 3);

    Insert into TABLE1 (id, year, month, parent_id)

    values (6 (2015), 12, 4);

    Insert into TABLE1 (id, year, month, parent_id)

    values (3 (2015), 11, 1);

    Insert into TABLE1 (id, year, month, parent_id)

    values (4 (2015), 11, 2);

    Insert into TABLE1 (id, year, month, parent_id)

    values (1, 2015, 10, null);

    Insert into TABLE1 (id, year, month, parent_id)

    values (2 (2015), 10, null);

    commit;

    and query

    with h as

    (select t.id, t.year, t.month, CONNECT_BY_ROOT t.id as parent_id from table1 t

    where t.year = 2015 and t.month = 12

    and CONNECT_BY_ROOT t.year = 2015 and CONNECT_BY_ROOT t.month = 10

    connect by prior t.id = t.parent_id)

    Select * from:

    Join table1 t left t.id = h.parent_id;

    It works, but when I put this request in the procedure pl\sql

    create or replace procedure is get_report (p_cur_out on sys_refcursor)

    Start

    Open the p_cur_out for

    with h as

    (select t.id, t.year, t.month, CONNECT_BY_ROOT t.id as parent_id from table1 t

    where t.year = 2015 and t.month = 12

    and CONNECT_BY_ROOT t.year = 2015 and CONNECT_BY_ROOT t.month = 10

    connect by prior t.id = t.parent_id)

    Select * from:

    Join table1 t left t.id = h.parent_id;             

    end get_report;

    /

    They do not compile. And in the fall, with the exception

    Errors of compilation for the PC of the PROCEDURE. GET_REPORT

    [Error: PL/SQL: ORA-00600: internal error code, arguments: [qctcte1], [0], [], [], [], [], [], [], [], [], []]

    Online: 6

    Text: with h as

    Error: PL/SQL: statement ignored

    Online: 6

    Text: with h as

    My version of oracle

    1Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production
    2PL/SQL Release 11.2.0.3.0 - Production
    3CORE Production 11.2.0.3.0
    4AMT for Linux: Version 11.2.0.3.0 - Production
    5NLSRTL Version 11.2.0.3.0 - Production

    What is the problem with my request? Or database? How to solve this problem?

    If you have access to MOS, you can search the reason of it. If you are using left join syntax instead of joining ANSI, owner Oracle procedure compiles and returns the result.

Maybe you are looking for

  • P850 satellite - failure with the recovery partition - boot selection failed

    Hello Hello, My problem is this: a few days ago, I update Windows and slow start is not blocked after several days decided to put the factory, always try to blur this back to the factory and is more, let me not to recognize the recovery partition, I

  • What is the number of MB of Satellite A300 part - 1 L 0 PSAGCE

    Hello I've got Toshiba A300 model No. - 1 L 0 PSAGCE-03100UGR. But there is a problem with graphics ATI 3450 (M82 chipset). After installing the correct drivers, I got blue screen on startup of Windows - and it says this file ati2... dll gives the pr

  • HELP - no sound!

    I have a y550, and I have a problem with the sound. in fact, it is d lack of sound. -It has a red light in the input jack audio d -No sound with or without headphones - headphones actually works when I listen to music test but just don't play all son

  • Losing GB off hard drives on my Dell Inspiron 17

    Every day I lose GB do not know why or where they're going. My Dell Inspiron 17 a (500) 444 GB to start (New). After downloading music and other software my laptop contained 355 GB of space left. 25/12/14 I had 203 GB and today, 26/12/14 there are 18

  • Why is my windows live mail sometimes email 16 times

    I send it once and people receive 16 times. Why