Possible bug - PLS-00372 creating BODY calculation of the PL/SQL FUNCTION

3.2 on Oracle APEX: 10 x e

I was creating a calculation for a page element by using the type 'BODY of the PL/SQL FUNCTION '. Step by step in the wizard when I entered my code block, I received the error PLS-00372. Here is the code:

DECLARE
l_return person_v.full_name%TYPE: = 'UNKNOWN ';
BEGIN

SELECT full_name
IN l_return
OF person_v
WHERE party_id =: P230_CONTACTED_PARTY_ID;

RETURN l_return;
EXCEPTION
WHEN NO_DATA_FOUND THEN
RETURN l_return;
END;

If I change my name of the variable to another thing that l_return the error disappears. Later, I can't change the name of the variable in l_return and I do not get the error if it seems to be the validation happening on just this page of the wizard.

Greg - it's because of a quirk in the validation, like imagine you. Workaround is to put a space between return characters and the terminal semi-colon, for example:

RETURN l_return;

Scott

Tags: Database

Similar Questions

  • APEX shortcuts using the source of the body of the PL/SQL function

    Hi all

    Recently, I came across the feature of "Shortcuts" in the "Shared components" section of the APEX and thought great, somewhere to set the common/standard items once, then use these several times in different pages of my application.

    This seemed to work correctly when you use the 'Source' of "HTML Text" or "HTML text with special characters escaped", but then I wanted to explore the use of the "Body of the PL/SQL function" option to create a more dynamic shortcut/variable on the base.

    This is where I came across a particular problem in the APEX (Version 3.2.1.00.10 on GR 11, 2 on Oracle Enterprise Linux). When I set my shortcut, and then perform a reference to my shortcut (using "MY_SHORTCUT") in an area of a page, the value of shortcut is back, but is added with the reference variable (ie. the 'MY_SHORTCUT' chain).

    For simplicity, my example looks like this (of course, my real world example is a bit more complicated, but this example produces the same error):
    (a) I define my shortcut called "MY_SHORTCUT" and using the body of the PL/SQL function under "Source Type", define my procedure as "htp.p(:USER)."
    (b) I then create a new page (basic HTML page), and a new region of the 'type'-> 'HTML Text (with shortcuts).
    (c) in the "Source region", I define my shortcut like - "MY_SHORTCUT".
    (d) I apply changes and then run the page.

    I'll be back will be name of the current user with "MY_SHORTCUT" appended/added immediately after the user name - for example. the string:-' BRAD «MY_SHORTCUT»»

    Question is - how to stop the shortcut/reference text "MY_SHORTCUT" to be added to the variable you want to see the and thereafter on your page? I am just wanting the variable, NOT the reference for the shortcut.  I do something wrong using the HTP package, and if yes, what should I use?

    If "MY_SHORTCUT" is defined as "HTML text with special characters escaped" (where I can refer to elements of application using the syntax '& USER.') so that everything works correctly. My reason for using the PL/SQL is to generate a more dynamic output variable, based on elements of application throughout the entire application - and of course the use of shortcuts to minimize coding and duplication.


    Thanks in advance,
    Brad

    Hello

    The body of the PL/SQL function must RETURN a value.

    Try:

    RETURN :APP_USER;
    

    Andy

  • PL/SQL expreesion and body of the PL/SQL function

    Hi all

    Value of source of items, we have options like static text, DB columns like this.
    But I did not use PL/SQL and PL/SQL function body expressions when I try to use its not to validate.
    I know what format I can use?
    Complete program of PL/SQL or the body of the function.
    If possible provide two programs simple expression PL/SQL and PL/SQL function body

    Hello

    Or use ELSIF rather than ELSE IF

    Andy

  • Filling point with the body of the pl/sql function

    Hello

    I want to fill an item "Show as text (saves the State)" in contrast to the other 2 points.

    The source of my question is:
    -Only when the current...
    -Body of PL/SQL function
    -Term source:
    DECLARE
    v_diff NUMBER;
    BEGIN
    v_diff: =: P1_AUFWAND_TOTAL -: P1_AUFWAND_BERECHNET;
    Return v_diff;
    END;

    Now I get this error:

    ORA-06502: PL/SQL: taking oder Wertefehler: Fehler beim zu if indication Zahl von
    Error ERR-1904 unable to calculate the default item: type = body of the function...

    I tried to find the problem with the conversion to_number:
    v_diff: = to_number(':P1_AUFWAND_BERECHNET'); or
    v_diff: = to_number (': P1_AUFWAND_BERECHNET', '999G999D00');

    What's not here? It's as if I'm making a simple mistake...

    Thanks for any help,
    Roger

    If the following code does not work for you, then one of the two elements are not the numbers:

    DECLARE
       v_diff   NUMBER;
    BEGIN
       v_diff := TO_NUMBER (:p1_aufwand_total)
                 - TO_NUMBER (:p1_aufwand_berechnet);
       RETURN v_diff;
    EXCEPTION
       WHEN OTHERS
       THEN
          RETURN SQLERRM;
    END;
    

    Denes Kubicek
    -------------------------------------------------------------------
    http://deneskubicek.blogspot.com/
    http://www.Opal-consulting.de/training
    http://Apex.Oracle.com/pls/OTN/f?p=31517:1
    -------------------------------------------------------------------

  • assign a value to a text element using the PL/SQL function body

    Hello

    I want to assign a value to a text element using PL/SQL function body option in the Source elements. But the below error when I try to apply it.

    Source code:

    declare
    name varchar2 (100);
    Start
    If v ("P3_CREHIDD") = 'Edit' then
    Select ename in the name of cpy_emp where empno = v('P3_EMPNO2');

    end if;
    end;


    ERR-1904 unable to calculate the default item: type = computation_type = function body declare name varchar2 (100); so start v ('P3_CREHIDD') = 'Edit' and then select ename in the name of cpy_emp where empno = v('P3_EMPNO2'); end if; end;.

    Thank you
    David.

    Hello

    Your body of the function doesn't return anything.
    Maybe it works

    declare
      l_name varchar2(100);
    begin
      if v('P3_CREHIDD') = 'Edit' then
        select ename
        into l_name
        from cpy_emp
        where empno = v('P3_EMPNO2');
      end if;
      RETURN l_name;
    end;
    

    BR, Jari

  • Possible bug - video frames are jumping all over the exported sequence, but not on the original

    Hi all

    I recently used first todo some basic video editing.

    When I released the final movie executives seem to jump around and it seems really dodgy.  See the example below and you'll see what I mean

    • The original for this clip source file plays very well (without any image jump) in all playes video, including the first one.
    • I tried to get out about each different type of available video format, but executives still jump
    • I use Premiere CS4 and the original video was recorded on a Samsung camcorder, which uses the codec of samsung SOUSOU.

    We never seen anything like this before?  I tried to play round with different settings, but still can't seem to get rid of the image jerky.

    Any help would be grately appreciated.

    Thank you

    Simon

    Convert this hardware Samsung to something editable RA, as MS DV AVI type2 before use, or use an application to Samsung.

  • Cannot create Materialized View using the PL/SQL procedure

    Hello

    I have a question related to the creation of materialized view.
    I have a stored procedure that creates the materialized view. When you try to perform this procedure, I get not enough privileges error: ORA-01031.

    When I run the content of this procedure as a PL/SQL block anonymous their materialized view is created without any complications.
    Can you please advice me on this subject?
    It is even possible to create a materialized view in the stored procedure as I found no info on this subject.

    Thank you
    Petr

    Hi chudapet,

    Whenever you make in procedure, you must have direct subsidies and not through a role.

    Most likely the grant to create a materialized view is available via a role to your username.
    Assign a direct grant to the user:

    grant create materialized view to scott;
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
    
  • Creating a fichierXML using the pl/sql procedure.

    Hello

    I have a scenario here. I need to create an XML file, in a format of perticular. Since this is not a well-formed XML format, I am facing questions during the creation of the file.

    The XML file format is as below.

    ARTICLE <>10-B < / SECTION >
    <? XML version = "1.0" encoding = "UTF-8"? >
    < name >
    < first > CBA < / first >
    BCD < middle > < / Middle >
    < Lastt > CBA < / last >
    <>brands
    < > 89 Subj1 < / Subj1 >
    < Subj2 > 89 < / Subj2 >
    < Subj3 > 89 < / Subj3 >
    < / brands >
    < / name >
    <? XML version = "1.0" encoding = "UTF-8"? >
    < name >
    < first > CBA < / first >
    BCD < middle > < / Middle >
    < Lastt > CBA < / last >
    <>brands
    < > 89 Subj1 < / Subj1 >
    < Subj2 > 89 < / Subj2 >
    < Subj3 > 89 < / Subj3 >
    < / brands >
    < / name >
    --
    --
    --
    < SECTIONCNT > 6 < / SECTIONCNT >

    I tried to create the file using the utl functions, but it did not work. I would like to know is there any other approach?


    -Anu

    This should keep you in suspense:

    DECLARE
    
      xml_prolog    clob := '';
      xml_header    clob;
      xml_trailer   clob;
      tmp_xml       clob;
      tmp_file      clob;
    
      cursor c_invoice is
        select xmlelement ("ABCD",
                 xmlelement ("BankSvcRq",
                   ...
                 )
               ).getclobval() as invoice_xml
        from ap_invoices_all ai
        where batch_id = :c_batch_id
        and org_id = :c_ord_id;
    
    BEGIN
    
      -- create the temporary clob :
      dbms_lob.createtemporary(tmp_file, true);
    
      -- fetch the header :
      select xmlelement ("BATCHHEADER", batch_name).getclobval()
      into xml_header
      from ap_batches_all ab
      where ab.batch_id = :c_batch_id
      and ab.org_id = :c_org_id;
    
      -- fetch the trailer :
      select xmlelement ("BATCHTRAILER", count(*)).getclobval()
      into xml_trailer
      from ap_invoices_all ai
      where ai.invoice_id = nvl (:c_invoice_id, ai.invoice_id)
      and ai.batch_id = :c_batch_id
      and ai.org_id = :c_org_id;
    
      -- append header
      dbms_lob.append(tmp_file, xml_header);
    
      -- fetch the invoices and append :
      for r in c_invoice loop
        dbms_lob.append(tmp_file, xml_prolog);
        dbms_lob.append(tmp_file, r.invoice_xml);
      end loop;
    
      -- append trailer :
      dbms_lob.append(tmp_file, xml_trailer);
    
      -- write file to directory :
      dbms_xslprocessor.clob2file(tmp_file, 'TEST_DIR', 'test.dat', nls_charset_id('AL32UTF8'));
      dbms_lob.freetemporary(tmp_file);
    
    END;
    /
    
  • Calculation of the IR, aggregate functions

    Hi all

    I generated an interactive report which must show counties, totals and averages.

    My question is something like below.

    5 1000 200 Row1
    10 2000 200 row2
    row3 5 500 100
    Total: 20 3500 175 (166)

    Let's say that the column with values 5,10,5 indicates the number of employees.
    column with values 1000,2000,500 are the total salaries of employees (respectively)
    column with the 200,200,100 values are averages. (which i use interactive report CALCULATION for values).

    the last line shows the totals and the avg (last row-last column)

    I have to get 175 which is right, but I'm 166 (using inbuild functionality)
    what his weight is summing the values 200,200,100 and then plunged by # of lines.
    I would like to see 3500/20 to this place.

    How do I get there?

    I use Apex 4.1 and 10g DB.


    Thank you
    Daniel

    Rather than rely on apex aggregated in this example, you can achieve with SQL

    Select deptno,
    Count (*),
    Sum (SAL),
    Round (AVG (SAL), 2)
    WCP
    GROUP BY deptno
    UNION
    Select deptno NULL,
    Count (*),
    Sum (SAL),
    Round (AVG (SAL), 2)
    WCP
    ORDER BY 1

    The result is...
    10 3 8750 2916.67
    20 5 10875 2175
    30 6 9400 1566.67
    -14 29025 2073.21

    It may be useful

    Chandra

    Published by: cmovva on February 9, 2012 11:52

  • conditional view using body of the Pl/SQL function returning a Boolean

    I have problems with the conditional display of a report.

    I have to select list: p50_facility and p50_supervisor.

    I entered the Sub function body of pl/sql returning a Boolean

    Begin
    If (: p50_facility is null or)
    (: p50_supervisor is null) THEN
    Return False;
    On the other
    Return True;
    End if;
    End;

    No matter what values are my articles on (null, not null), the report shows.

    What I am doing wrong?

    Hello

    The list values will be null only until the first time that the page is sent. Subsequently, the value is likely to be "null %."

    You should do something like:

    BEGIN
     IF (:P50_FACILITY IS NULL OR :P50_FACILITY = '%' || 'null%' OR :P50_SUPERVISOR IS NULL OR :P50_SUPERVISOR = '%' || 'null%') THEN
      RETURN FALSE;
     ELSE
      RETURN TRUE;
     END IF;
    END;
    

    Andy

  • Populating list right shuttle - PLS-00372 error

    Dear experts! Today, I need to set up a list of shuttle to update, insert, and delete data.

    I created my shuttle and a process page (before the region) which is supposed to fill the right side of the shuttle with the data.

    While the shuttle itself works perfectly, the process to fail with an error PLS-00372-> RETURN statement cannot contain an expression

    Just, I don't understand what I missed. The values of the Shuttle are strings, and my code is as follows:
    DECLARE
     vAREA APEX_APPLICATION_GLOBAL.VC_ARR2;
     i NUMBER := 1;
    BEGIN
     FOR c IN (SELECT DISTINCT LNG_GEBIET FROM TBL_USER_CONTROL WHERE LNG_USER = :P3_USER)
     LOOP
      vAREA(i) := c.LNG_GEBIET;
      i := i + 1;
     END LOOP;
     RETURN APEX_UTIL.TABLE_TO_STRING(vAREA,':');
    END;
    P3_USER is a part of the of the region that holds the shuttle.

    Please can you me whatelse I have to consider?

    Thank you very much and besrt cordially,

    SEB

    Hello

    If I understand correctly, you need

    DECLARE
     vAREA APEX_APPLICATION_GLOBAL.VC_ARR2;
     i NUMBER := 1;
    BEGIN
     FOR c IN (SELECT DISTINCT LNG_GEBIET FROM TBL_USER_CONTROL WHERE LNG_USER = :P3_USER)
     LOOP
      vAREA(i) := c.LNG_GEBIET;
      i := i + 1;
     END LOOP;
     :Px_MY_SHUTTLE := APEX_UTIL.TABLE_TO_STRING(vAREA,':');
    END;
    

    Replace Px_MY_SHUTTLE with your name of the shuttle.
    If you are PL/SQL type, he cannot return anything.

    If you want to use the function, then place your code of calculation and select the correct type of "body of the PL/SQL function.

    BR, Jari

  • Create a form in the form of dynamic array

    Hello world

    It is a question aims to Denes Kubicek, but if it is not on the forum today so perhaps someone else could help me.

    I am creating a tabular form on a table view. The thing is that the primary key is not met by trigger, the primary key is 2 varchar columns.

    For example. *
    SVC_NAME
    SVC_HST_IP
    SVC_NUM
    SVC_DB_TYPE
    SVC_APP_TYPE
    SVC_APP_NAME
    SVC_BK_TYPE

    I try so to create a tabular presentation based on the columns above, where the SVC_NAME and the SVC_HST_IP will be inserted as primary keys.

    I saw on the site Web of Dene Kubiceks APEX that it has been able to create a tabular presentation that would meet my needs, dynamics of tabular form. The only thing is that I fell in the first stage. Please could someone provide me with some guidance as to where to put the code?

    What I did at this point, it's place article 1 of the code "1. "SQL query / query SQL that returns the PL/SQL function" in a report. However, when I run the page I get "could not parse the SQL query: ORA-00936: lack the expression" error message. I guess article 2 and 3 will be the application process but I have not at this point yet. I'm not sure about article 4.

    Any help would be appreciated,
    Thank you
    -N.S.N.O.

    N.S.N.O.

    See this example on how to proceed with tables without primary key:

    http://HTMLDB.Oracle.com/pls/OTN/f?p=31517:157

    that applies in your case. Using ROWID is also an option.

    Everything that you later call your primary key is not important, since this example uses ROWID.

    Denes Kubicek
    ------------------------------------------------------------------------------
    http://deneskubicek.blogspot.com/
    http://www.Opal-consulting.de/training
    http://Apex.Oracle.com/pls/OTN/f?p=31517:1
    ------------------------------------------------------------------------------

  • Analyze: Body of PL/SQL function returning a SQL query

    I need to get the final SQL returned by the PL/SQL function.
    I'll use this final SQL in a procedure.
    Please provide only a few tips on how to get the SQL code. I already looked in the DBMS_SQL package, but I don't know if this is the right place to look.


    Kind regards
    Sumit
    declare 
    
      l2 varchar2(2000);
    
    begin
    
      l2:= 'Select NAME,ORIGINATED,OWNER,ORIGINATOR,';
      l2:= l2 || 'DESIGNATED_UNIT,SOURCE,';
      l2:= l2 || 'REFERENCE';
      l2:= l2 || ' from MV_DETAILED_DATA';
    
      /*
        Copy dynamic query SQL to application item for later use.
      */
      :app_item := l2;
    
      wwv_flow.debug('l2: ' || l2);
    
      return l2;
    
    end;
    

    I always use a call of debugging in the region of body of the PL/SQL function returning a SQL query sources so the real generated SQL can be quickly entered via the debug mode.

  • Possible bug on role assignments

    I am using SOA/BPM 11.1.1.7.

    I found a possible bug when you deploy a BPM Application which mixed assignments (some directly to one user, others to a role of Application BPM (created in the workspace).

    I did two tests.

    Test 1.  Created a project/process of BPM with two lanes.  In organization, I assigned the roles of corridor users (to the embedded Weblogic LDAP).  On deployment, these roles were driven from the area space of work/Administration/roles (when logged in as a Weblogic).

    Test 2.

    In the workspace I created a few BPM roles (and put assignments users), then in a project of assigned BPM Application roles to my role of corridor.

    However, I created a corridor and made the assignment directly to the user.

    On deployment, the role which has been directly attributed to the user at the level of BPM projects has been eliminated NOT to the role area.

    A video of it is here: http://youtu.be/bWtEIRavlEY

    Stuart

    Hi Stuart,

    Could check you how your mapping roles work if you check "deployment of existing objects of update on ' option in organization.xml?

  • Possible bug in LR6 (CC) re: list of keywords

    Something strange is happening in my new LRcc, which looks like a bug, but there may be a new behavior that I don't understand.

    When I try to add a new keyword by clicking on "+" in the "Keywork list" header, the new keyword is not in the list.  It does not "keywords recent' set in the keywords Panel.  He also gets attached to a selected photo if I have this checked when I create the key word as a tag.  But, nothing in the list.  However, if I create a new keyword, which is a sub of an existing keyword, by clicking right on, say, "birds" in my list of keywords and selecting 'create tag keyword inside the birds', the keyword appears.  I confirmed that it worked as planned in LR5.  Y at - it a new procedure to put a new keyword in the list, or is it just a bug?  Or do I do something stupid (always a distinct possibility).

    CC of LR newest release, MacOS 10.10.2 on a MacPro.

    Thank you, in advance, for advice or fix.

    No, it wasn't the problem (I had not checked the option 'people' on the keyword, and I was showing the keyword 'all' in the list) but I discover.  It turns out that one of my key words had the option "Put new keywords inside this keyword" set, which meant that my new keywords appear at the top level, but were inside my keyword "teams" where I could not see them.  I do not know if this option existed in LR5, and I have no idea why it has been activated for "teams", but who, off, solved the problem.

Maybe you are looking for