Calll to a procedure via the Decode function

Hello

I just want to know if it is possible to call precudure as below,

Select inv.invoice_id, decode ('AS_AP_INV_APPROVESTATUS (inv.invoice_id)', ' n,+)
Decode(AMOUNT_PAID,,'Enterd',0,'Entered')) stat
from apps. AP_INVOICES_ALL inv

This property returns only the value (null).

Is a syntax error or is at - it another way to call it?

Thank you

First of all, it must be a function, not a procedure ;-)

Secondly, you should not put it inside quotes - you do not claim the function, you're simply decode if your string is equal to 'n'.

select inv.invoice_id, decode(AS_AP_INV_APPROVESTATUS(inv.invoice_id),'N',
decode(AMOUNT_PAID,null,'Enterd',0,'Entered')) stat
from apps.AP_INVOICES_ALL inv

This assumes that AS_AP_INV_APPROVESTATUS is a function that returns a string value.

Tags: Database

Similar Questions

  • What approach would be best for creating a condition of display by using the DECODE function criteria?

    Hello world

    The requirement is to filter a LOV based on a date entered by the user and a condition that uses DECODE. If : update or : pSystemLinkageFunctionDate Exchange then the LOV should be updated. So, I created a VO of read-only by using SQL. But I can't create a view of criteria that uses the DECODING. What approach would be the best method to meet this requirement?

    Select

    PET.expenditure_type

    pet.start_date_active

    pet.end_date_active

    petsl.start_date_active

    petsl.end_date_active

    petsl.system_linkage_function

    Of

    pa_lookups pl

    pa_expend_typ_sys_links petsl

    pa_expenditure_types pet

    pa_system_linkages psl

    where 1 = 1

    and pet.unit_of_measure = pl.lookup_code

    and pet.expenditure_type = petsl.expenditure_type

    and petsl.system_linkage_function = psl.function

    and pl.lookup_type = 'UNIT '.

    and: pDate between nvl(pet.start_date_active,:pDate)

    and nvl(pet.end_date_active,:pDate)

    and: pDate between nvl(petsl.start_date_active,:pDate)

    and nvl(petsl.end_date_active,:pDate)

    and petsl.system_linkage_function = decode(:pSystemLinkageFunction,'L','S','E')

    James

    Hi Timo,

    ADF business components: 11.1.1.62.29

    Platform Java (TM): 1.6.0_24

    Oracle IDE: 11.1.1.6.38.62.29

    Support for version control: 11.1.1.6.38.62.29

    Thanks for the link... I'll take a look. However, the DECODING work now; I wasn't quite deep in the stack trace to find the error that turned out be related to one of the dregs.

    James

  • With regard to the decode function

    Hi all

    I want to know abt decode function in sql-oracle
    I... e passing parameters to decode using decode using the ': ' bind the parameter

    Select the WORK, decode(:j,'CLERK','MANAGER','ANALYST','EXEC',JOB) of EMP;
    I declared the variable j in sql environment
    VARCHAR2 (20) OF THE VARIABLE J;
    I have the query exec
    and had the clerk as an input parameter
    but the o/p as iam
    JOB DECODE(:J)
    --------- ---------
    MANAGER
    MANAGER
    MANAGER
    SELLER SELLER
    SELLER SELLER
    SELLER SELLER
    CLERK CLERK
    SELLER SELLER
    THE ANALYST ANALYST
    CLERK CLERK
    THE ANALYST ANALYST

    JOB DECODE(:J)
    --------- ---------
    CLERK CLERK

    12 selected lines.

    SQL > PRINT J;

    J
    --------------------------------------------------------------------------------

    im not getting o/p
    so please hlelp me only: should be used not &
    This is my first thread.
    execuse me if no errors

    tons of thanks in advance to all

    Hello

    We can try like this...

    Begin
    : j: = 'CLERK ';
    end;
    /

    then, we execute your SQL query as below...

    Select the WORK, decode(:j,'CLERK','MANAGER','ANALYST','EXEC',JOB) OF the EMP
    where JOB =: j;

    I think that this will solve your problem

    Kind regards
    Soak the Sevin rana

  • Need help with the DECODE function

    Hello

    I try to use by default within the decode service and whenever I get a missing expression. I searched everywhere and can not know what I am doing wrong. Thank you

    Select decode (request_id, 0, "no file found", by DEFAULT)
    select decode (request_id,0,'No files found', request_id)...
    
  • Error for the decode function

    I'm getting ORA-00904: "ITEM_NUMBER": invalid identifier. Thanks for the help
    SELECT (SUBSTR (item, 1, 4) || '.' || SUBSTR (item, 5)) item_number,
           idescr short_description, idescrl long_description, iunits unit_name,
           ispecyr spec_year, iobselet, item,
           ROW_NUMBER () OVER (ORDER BY DECODE
           (insortexp, 'item_number ASC', item_number) ASC,
            DECODE (insortexp, 'short_description DESC', short_description) DESC,
            DECODE (insortexp, 'long_description ASC', long_description) ASC,
            DECODE (insortexp, 'unit_name DESC', unit_name) DESC,
            DECODE (insortexp, 'spec_year ASC', spec_year) ASC,
            item_number)
      FROM itemlist
     

    so, there is no, but you should look at your alias...

    I think that it should work... but I don't have your database

                OPEN outitemcur FOR
                   SELECT (SUBSTR (item, 1, 4) || '.' || SUBSTR (item, 5)
                          ) item_number,
                          idescr short_description, idescrl long_description,
                          iunits unit_name, spec_year, iobselet, item
                     FROM (SELECT (SUBSTR (item, 1, 4) || '.' || SUBSTR (item, 5)) item_number,
                                  idescr short_description,
                                  idescrl long_description, iunits unit_name,
                                  ispecyr spec_year, iobselet, item,
                                  ROW_NUMBER () OVER
                                  (ORDER BY DECODE  (insortexp, 'item_number ASC', item) ASC,
                                   DECODE (insortexp, 'short_description DESC', idescr) DESC,
                                   DECODE (insortexp, 'long_description ASC', idescrl) ASC,
                                   DECODE (insortexp, 'unit_name DESC', iunits) DESC,
                                   DECODE (insortexp, 'spec_year ASC', ispecyr) ASC,
                                   SUBSTR (item, 1, 4) || '.' || SUBSTR (item, 5)) r
                             FROM itemlist)
                    WHERE r BETWEEN instartrowindex AND inendrowindex;
    
  • Please help fix the Decode function

    DECODE (p_resp_key,'|) "' AP" ' |', LINT_LOGI_STG_ITEM_DETAILS_PKG. Description of the AS GET_AP_ITEM_CATEGORY_DTL (ol.inventory_item_id), ldmf_istore_order_pkg.get_wwdb_prod_description (ol.inventory_item_id))

    I'm getting errors during execution analysis. I believe that something is incorrect in Decode statement. I call this statement of Decopde in the package. Help, please.

    Concerning
    M

    I think I've found the error:

    p_resp_key is a parameter to your home...

    If it could work.

     := 'select ... DECODE('''||p_resp_key||''',''AP'',LINT_LOGI_STG_ITEM_DETAILS_PKG.GET_AP_ITEM_CATEGORY_DTL(ol.inventory_item_id),ldmf_istore_order_pkg.get_wwdb_prod_description(ol.inventory_item_id)) AS description ...'
    

    I still very strongly suggest to do not to use the dynamic version of this code. You have a couple of potential Sql Injection issues in there and it will be better if its not done dynamically.

    Published by: W. Sven on September 11, 2009 14:15

    Published by: W. Sven on September 11, 2009 14:17

  • Problem using the DECODE function

    I'm trying to decode what follows, but I seem to have a problem of syntax:
    decode
    (
           p.balls,p.strikes,
           1,0 '1-0 Count',
           2,0 '2-0 Count',
           3,0 '3-0 Count',
           0,1 '0-1 Count',
           0,2 '0-2 Count',
           1,1 '1-1 Count',
           2,1 '2-1 Count',
           3,1 '3-1 Count',
           0,2 '0-2 Count',
           1,2 '1-2 Count',
           2,2 '2-2 Count',
    ) as Count,
    what I'm trying to take place is whenever the column of balls a '1' and the column to strike a '0' to decode the number of 1 - 0"etc...

    Hello

    Why use DECODE at all?

    TO_CHAR (p.balls) || ' -' || TO_CHAR (p.strikes) || ' Count'
    

    Assuming that you really need to use DECODE: it only works on a single value.

    You can combine your two values into one:

    DECODE ( (10 * p.balls) + p.strikes
           ,  0, '0-0 Count'
           ,  1, '0-1 Count'
           ,  2, '0-2 Count'
           ,  3, '0-3 Count'
           , 10, '1-0 Count'
    ...
           , 32, '3-2 Count'
           )
    

    or DECODE the two columns separately.

    DECODE ( p.balls
           , 0 '0-'
           , 1 '1-'
           , 2 '2-'
           , 3 '3-'
           )
    ||
    DECODE ( p.strikes
           , 0 '0 Count'
           , 1 '1 Count'
           , 2 '2 Count'
           )
    
  • Delete name via the SQL function

    Hello

    How to remove the name of list of names.

    for example

    1 ashish Sharma

    2 John Parker

    Angel 3, Siemens

    As a result, I need...

    1 Ashish

    2 John

    3 Angel

    Thanks in advance

    .

    Published by: Vanessa B on March 7, 2013 12:32 AM
    -duplicate content... Server prob

  • Decode the help function

    Hello

    I'm new to the development of Oracle.

    MY requirement:

    I need to fill a column "ISMSG" by YES / NO based on the following condition

    When the code = the of ' or 'O'... the 'ISMSG' column should display any other YES no.

    That is, output should be like

    CODE ISMSG

    A NO
    S YES
    S YES
    O YES

    My code for the Decode function:

    CASE
    WHEN s = c.code ' THEN decode (c.code, the of ',' YES, 'NO')
    WHEN c.code = 'o' THEN decode (c.code, 'O', 'YES', 'NO')
    END ISMSG

    My code is correct? If Yes is the best way to do it?
    If this is not the case, correct the code.

    Is there an effective way to do it?

    Thanks in advance.

    Hello

    You can use CASES or DECODE for this; There is no need to use both.
    With the help of CASE:

    SELECT  c.code
    ,     CASE
             WHEN  c.code  IN  ('S', '0')  THEN  'YES'
                                               ELSE  'NO'
         END     AS ismsg
    FROM    table_x   c;
    

    Using DECODE:

    SELECT  c.code
    ,     DECODE ( c.code
                , 'S'      , 'YES'
                , '0'      , 'YES'
                              'NO'
                )          AS ismsg
    FROM    table_x   c;
    

    I suggest that you forget to DECODE and use always the CASE, at least while you are beginner.

    CASE may do everything they can to DECODE. There is a little bit simple, situations where DECODE is a little shorter than the CASE and therefore a bit clearer, but only a little and, as I said, these are just simple situations, and CASE is clear enough in them.
    DECODE is never much shorter or clearer than the CASE. The reverse is not true: there are many situations where the CASE is much, much shorter and lighter than DECODE.

  • How can I disable the SendNow function?

    I want to avoid the users you send a PDF via the SendNow function,.

    Hi ZB hide SendNow,

    Can you please help me with more information.

    Let me know which application where the SendNow service is built it is outlook, Reader, or other applications?

    Kind regards

    Ajlan Huda.

  • Oracle form functions and procedures in the APEX, how?

    I'm working to recreate in the APEX, already existing read only forms in Oracle Forms. Report features interactive APEX among other things, in fact worth as well as to target a different audience than utilizies versions of Oracle Form. Versions of Oracle Forms use a lot of pre and post query triggers, PLSQL functions.

    In Oracle Forms that places, these functions can be found in the "Units of program" section of the form. A feature typical of this kind, based on a particular Mission ID route, collecting names of regular passengers, is shaped with a comma and a space after each of them, in a single string that is returned and displayed the list of passengers of a line.

    I have all of this written code so I can move most of the main request of the Oracle form in an interactive report. These functions and triggers called in the form of the "Units of program" section of the Oracle form rather than stored in the database schema in a package, where they would go inside the APEX? Can I create a 'shortcut' in the APEX and call it from the interactive report "Source RĂ©gion"? I can create the PLSQL function at the level of the region of the interactive report or page level? Or, my best bet creates a package that is stored in the database, all these functions and/or proecedures I might need the original form of Oracle?

    Some advice would be greatly appreciated.

    RLBickham wrote:
    I don't think I've been pretty clear in the description of the specific thing I want to do, simply, it does not reach the level of forms of conversion of the APEX. It is basically a problem of PLSQL function.

    I have an interactive report which is currently 90 percent of what I want however, each line, which represents a Mission may have several feet. Each arm has two places or ICAO codes attached to it. Based on the number of Mission, I want to loop through the array of leg, collect all the codes of ICAO for this Mission, put them together in 1 variable separated by a coma and add this variable to display the columns in this interactive report as the last column.

    In Oracle Forms, I have a function registered in the database, which is called in the main query. Maybe I ask a question that does not need to be asked, but anyway my question is can I put this function currently in the database somewhere within the interactive report and somehow reference it via Http, or should I just stick with set of functions and procedures in the packages stored in the database and called the conventional way?

    You could switch the function to the database and call it from the report query, but it sounds as if it were superfluous. In the report query using any form of Re: 4. How can I convert rows to columns? is appropriate for your version of the (unspecified) database.

    -----

    When you have a problem, you will get an answer faster, more efficient including information as much information as possible from the outset. This should include:

  • Full version of APEX
  • Complete operating system DB, version, edition, host
  • Architecture of Web server (EPG, SST or APEX listener/host operating system)
  • Browser (s) and version (s) used
  • Theme
  • Model (s)

  • Region/section type (s) (particularly as to distinguish if a 'report' is a standard report, an interactive report, or indeed a 'update report' (i.e. a tabular presentation))

    With APEX, we also had the chance to have a great resource in apex.oracle.com where we can reproduce and share problems. Reproduce things is the best way to solve most of the questions, particularly those relating to the layout and Visual formatting. If you expect a detailed response it is appropriate that you take on an important part of the effort by getting as much as possible with an example of the problem on apex.oracle.com before asking for help on specific issues, then we can see firsthand.

  • How to use the NVL function in decoding?

    Hi all

    How to use the NVL function in decoding?

    SELECT Decode (Sign (sum (nvl (7), 0)-nvl (sum (5), 0)), - 1, 0, (sum (nvl (7), 0)-nvl (sum (5), 0)) QTY)

    of the double

    Thank you

    You should not do that...

    Greatest (NVL (Sum (Quantity), 0)-NVL (SUM (quantity_received), 0), 0) AS qty_arrival

    will do the same

    HTH

  • Precomposer new function AE CC via the script

    As we know new AE CC got awesome box called "Adjust duration of both extended the selected layer composition".

    The default setting in the script guide is:

    [object LayerCollection] .precompose (array, string, [bool]);


    But it does not work with a new checkbox.

    So how to operate with a new checkbox via the script?

    Thanks for reading.

    I found that precomp function does not work with app.project.activeItem.selectedLayers;

    So here's the finishing touch that works with selected layers.

    See you soon

    
    function precompLayer() {
    var myComp = app.project.activeItem;
    if(myComp == null){alert("Please, select your composition"); return false;}
    
       var selectLayers = app.project.activeItem.selectedLayers; // selected
       if(selectLayers.length <1 ){alert("Please, select layers"); return false;}
    
       myLayers = [];      // precomp function works only with layers indexes, so array should contain layers indexes
    
            for (var l = 0; l< selectLayers.length; l++){
                myLayers.push(selectLayers[l].index);            // new array with layers indexes
            }
    
     var precompIndices = myLayers;  //change this to customize
            var precompName = "new_comp";  //change this to customize
            var parentComp = app.project.activeItem;  //change this to customize
            clearOutput();
            writeLn("Creating precompose");
            app.beginUndoGroup("Precompose");
            var Inpoint = 0;
            var Outpoint = 0;
    
            var precomp = parentComp.layers.precompose(precompIndices, precompName, true);
            var adjustStartTime = precomp.duration, newCompDuration = 0;
            writeLn(precomp.layers.length+" layers in procompose");
    
            for(var i=1; i<=precomp.layers.length; i++) {
                var layer = precomp.layer(i);
    
                (Inpoint > layer.inPoint) ? Inpoint = layer.inPoint : Inpoint;                  // begin of precomp
                (Outpoint < layer.outPoint) ? Outpoint = layer.outPoint : Outpoint;       // end of precomp
    
                var duration = Outpoint - Inpoint;
                adjustStartTime = adjustStartTime > layer.inPoint ? layer.inPoint : adjustStartTime;
                newCompDuration = newCompDuration < duration? duration : newCompDuration;
            }
                writeLn("New duration = "+newCompDuration);
    
            for(var i=1; i<=precomp.layers.length; i++) {
                precomp.layer(i).startTime -= adjustStartTime;
            }
    
            precomp.duration = newCompDuration;
            parentComp.layer(precompName).startTime = adjustStartTime;
            app.endUndoGroup();
    
    writeLn("Done!");
    }
    precompLayer();
    
  • Can we call the procedure inside the function?

    Hello

    Can we call the procedure inside the function?

    Thank you
    Brij

    845712 wrote:

    Can we call the procedure inside the function?

    Strange question to ask.

    Yes. This is the standard behavior in most (if not all) procedural and object oriented languages.

    A procedure, function or a method is a unit of code.

    You can call one of the other units. Units can call themselves (recursion). Technically, this means simply by pushing the battery current (to save the stack of the current device memory), the call to the new unit and then popping up battery when control is returned to the unity of the appellant.

    There are very few exceptions to this. The only one that comes to mind programming languages I've used through the years, is natural 1 - could not call a new unit of code to replace the existing one in memory. If no call-and-return was possible.

    Exactly what did you ask this question? Some newcomers to confused Oracle SQL and PL/SQL - two different languages aside server. And then also mistaken for PL/SQL client command vocabulary of SQL * more.

    You will need to make sure that understand the basics of programming (applies to most current programming languages) and Oracle concepts.

  • Decode function in the Update statement

    Hi all

    I'm writing a query where I can update a pastdue_fees column in a table of book_trans based on a difference between the return_dte and due_dte columns.

    I use Oracle SQL. That's what I have so far for my decoding function:

    SQL > SELECT
    2 DECODE (SIGN ((return_dte-due_dte) * 2),)
    3 '-1 ', ' 0',
    4 '1', '12', 'Null')
    5 FROM book_trans;

    DECO
    ----
    Null value
    12
    Null value
    0

    If the logic is that, if the sign is - 1, the value in the return_dte column must be 0; If it is + 1, then it has 12 and everything else is Null.

    So now, I have to conclude my function of decoding of the update statement to update the columns. However, I get the error messages.

    The logic should be:
    UPDATE book_trans SET PastDue_fees = decode (expression)

    I gave him a few different tests with the following results:

    SQL > UPDATE book_trans
    2 SET pastdue_fees = SELECT
    3 DECODE (SIGN ((return_dte-due_dte) * 2),)
    4 '-1 ', ' 0',
    5 '1', '12', 'Null')
    6 FROM book_trans.
    SET pastdue_fees = SELECT
    *
    ERROR on line 2:
    ORA-00936: lack of expression


    SQL > UPDATE book_trans
    2 SET pastdue_fees =
    3 DECODE (SIGN ((return_dte-due_dte) * 2),)
    4 '-1 ', ' 0',
    5 '1', '12', 'Null')
    6 FROM book_trans.
    OF book_trans
    *
    ERROR on line 6:
    ORA-00933: SQL not correctly completed command.

    Any help or advice would be greatly appreciated I got SQL for about six weeks and not very competent!

    Thank you!

    882300 wrote:
    Hi all

    I'm writing a query where I can update a pastdue_fees column in a table of book_trans based on a difference between the return_dte and due_dte columns.

    I use Oracle SQL. That's what I have so far for my decoding function:

    SQL > SELECT
    2 DECODE (SIGN ((return_dte-due_dte) * 2),)
    3 '-1 ', ' 0',
    4 '1', '12', 'Null')
    5 FROM book_trans;

    DECO
    ----
    Null value
    12
    Null value
    0

    If the logic is that, if the sign is - 1, the value in the return_dte column must be 0; If it is + 1, then it has 12 and everything else is Null.

    So now, I have to conclude my function of decoding of the update statement to update the columns. However, I get the error messages.

    The logic should be:
    UPDATE book_trans SET PastDue_fees = decode (expression)

    I gave him a few different tests with the following results:

    SQL > UPDATE book_trans
    2 SET pastdue_fees = SELECT
    3 DECODE (SIGN ((return_dte-due_dte) * 2),)
    4 '-1 ', ' 0',
    5 '1', '12', 'Null')
    6 FROM book_trans.
    SET pastdue_fees = SELECT
    *
    ERROR on line 2:
    ORA-00936: lack of expression

    SQL > UPDATE book_trans
    2 SET pastdue_fees =
    3 DECODE (SIGN ((return_dte-due_dte) * 2),)
    4 '-1 ', ' 0',
    5 '1', '12', 'Null')
    6 FROM book_trans.
    OF book_trans
    *
    ERROR on line 6:
    ORA-00933: SQL not correctly completed command.

    Any help or advice would be greatly appreciated I got SQL for about six weeks and not very competent!

    Thank you!

    If you really really really want to update the entire table, the syntax would be...

    UPDATE book_trans
       SET
          pastdue_fees  = DECODE(SIGN((return_dte - due_dte)*2), -1, 0, 1, 12, Null);
    

    I took out all the single quotes. If you actually have a string column and store all numbers in there so it must be reported as a NUMBER column and not a column of type character (varchar2).

    ALWAYS use the appropriate data type, it will save you a ton of headaches in the future.

    Also, since you are new to the forum, please read the FAQ to learn etiquette and what not.

    http://wikis.Sun.com/display/Forums/Forums+FAQ

Maybe you are looking for

  • Always problems of registration of passwords

    I followed the instructions in: http://support.Mozilla.org/en-us/KB/make-Firefox-remember-usernames-and-passwords?s=saving+passwords & r = 5 & e = & did = sBut I still can't the browser to prompt me to save the password. I've deleted and reinstalled

  • HP Pavilion H8-1220 and compatibility battlefeild 3

    Hello, I just me a pc.several H8-1220 people said that battlefeild 3 must run on this machine.but that a site of benchmark with a selector of game says it will run on min, but nvidia card benchmark said it won't be no and says that I need a GTX8800 N

  • DV5 keyboard - 1116em HP Pavilion does not?

    Hello! I have a problem with the keyboard of my laptop. his does not work. even if the MCIR driver is also installed and in good condition. can u help me solve the problem?

  • CSCug34485 - IOS OSPF LSA type vulnerability Injection

    Hi people, We are preparing the upgrade of all our routers to fix this bug or close this vulnerability. We have some devices form the SXJ which run the 12.2 (33). However, the corrected version "known" indicates that the version 12.2 (33) SXJ6 should

  • Router vpn site to site PIX and vpn client

    I have two on one interface on the pix vpn connections that terminate VPN. client vpn and VPN site-to-site have passed phase one and two and decrypt and encrypt the packets. However as in another post I can not ping through the l2l vpn. I checked thi