Schedule a Workbook using PL/SQL Function.

Hi,
Trying to schedule a workbook which uses a PL/SQL function(the function inserts some values to a custom table).
Workbook when run in desktop works fine and am able to see the results. but when run as a scheduled workbook it results with an error: Single query returns multiple rows.
Any Ideas to get around this problem...
Thanks!
Nani.

There could be a multitude of problems. Somewhere, the PL/SQL is selecting data using a SELECT ... INTO ... FROM type construct. Problem is that multiple records are being returned, and the code wants a cursor or some other mechanism.
Look at the places where the PL/SQL is selecting data, and make sure that only 1 row is being returned. The PL/SQL code may need to be modified to purge data before or after to ensure subsequent runs will not be a problem. There could also be a commit statement out of place that isn't committing a deletion, or is preventing a rollback.
With the way the workbook is scheduled, the PL/SQL could get called multiple times, but this seems unlikely as it works fine in desktop.

Similar Messages

  • How to create SAVE button in Workbook using BI IP Functionality

    Hi All,
    I have Real-time Infocube (ZCUBSDID) with me. Planning has been done on the cube using BI-IP (like Aggregation level, filter, planning function and planning sequence are present there).
    As an Input i have everything in Quality system like I can access query in Bex Anlyzer (Input Ready Query) and also i have workbook associated with the query. SAVE button is also present on workbook which is giving result based on fiscal year and version.
    Now my task is to create workbook on Development system with the same functionality as Quality System.
    I have same Query available on DEV system also. I created new  Workbook but SAVE button is not available in my workbook.
    Can anyone suggest how to create SAVE button in my new workbook.
    I am new in IP side so please let me know if i can get any help from workbook which is already present in Quality system.
    Which type of analysis i should do to come out with solution.....otherwise let me know step by step procedure to create SAVE button on workbook using BI-IP functionality.
    It will be great help. My advance thanks goes to you people.
    Thanks,
    Rupali Singh

    Check points 19 & 20 on this link http://help.sap.com/saphelp_nw2004s/helpdata/en/43/a033e0f56e21b5e10000000a1553f6/frameset.htm.
    Command to be called on SAVE button is SAVE_AREA as explained in the point 20.
    Regards,
    Deepti

  • Using pl/sql functions for transformation

    How can I use pl/sql functions in the transformation mapping field for my interface?
    I have a name field where firstname and lastname are concatenated via a space-character and I would like to extract this 'name' field to 2 separate database attributes.
    This means that I need to use a function that uses SUBSTRING and INSTR to be able to get the firstname and lastname separatly out of the name-field.
    The INSTR-function isn't known inside the expression editor in ODI so I'm wondering how I can use my own function?

    Hi Romanna,
    Are you sure? Where did you do your transformation?
    -Source, Staging area or Target
    I try this on Oracle target...
    FIRST_NAME = substr(MYTABLE.FIRST_LASTNAME, 1, instr(MYTABLE.FIRST_LASTNAME, ' ')-1)
    LAST_NAME = substr(MYTABLE.FIRST_LASTNAME,instr(MYTABLE.FIRST_LASTNAME, ' ')+1)

  • Error using Extended SQL Function substr

    I want to be able to look for the first three letters of a month in the XML and if found replace the 3 letter month (for example SEP-05 to September 05). I have tried the following which throw a namespace exception. Please let me know what I may be doing wrong?
    1. <?if:(xdofx:substr(../fsg:ColContext[2]/fsg:ColHeadLine2,1,3)='SEP'?>September<?end if?> should give me September.
    The above fails with: Font Dir: E:\Program Files\Oracle\XML Publisher Desktop\Template Builder for Word\fonts
    Run XDO Start
    RTFProcessor setLocale: en-us
    FOProcessor setData: E:\Work\Bacardi\Reports\XML\US GAAP BALSHEET\XML BL Dir Rpt BS YTD_0126.xml
    FOProcessor setLocale: en-us
    java.lang.reflect.InvocationTargetException
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at oracle.apps.xdo.common.xml.XSLT10gR1.invokeNewXSLStylesheet(XSLT10gR1.java:514)
         at oracle.apps.xdo.common.xml.XSLT10gR1.transform(XSLT10gR1.java:192)
         at oracle.apps.xdo.common.xml.XSLTWrapper.transform(XSLTWrapper.java:156)
         at oracle.apps.xdo.template.fo.util.FOUtility.generateFO(FOUtility.java:916)
         at oracle.apps.xdo.template.fo.util.FOUtility.generateFO(FOUtility.java:869)
         at oracle.apps.xdo.template.fo.util.FOUtility.generateFO(FOUtility.java:204)
         at oracle.apps.xdo.template.FOProcessor.createFO(FOProcessor.java:1535)
         at oracle.apps.xdo.template.FOProcessor.generate(FOProcessor.java:925)
         at RTF2PDF.runRTFto(RTF2PDF.java:590)
         at RTF2PDF.runXDO(RTF2PDF.java:443)
         at RTF2PDF.main(RTF2PDF.java:237)
    Caused by: oracle.xdo.parser.v2.XPathException: Namespace prefix 'xdofx' used but not declared.
         at oracle.xdo.parser.v2.XSLProcessor.reportException(XSLProcessor.java:782)
         at oracle.xdo.parser.v2.XSLProcessor.newXSLStylesheet(XSLProcessor.java:564)
         ... 15 more
    2. For the year, I would use another form field and do something like this next to the month above: <?xdofx:substr(../fsg:ColContext[2]/fsg:ColHeadLine2,5,2)?> for a result of '05'

    Hasan
    XSL has many native string manipulation functions so you do not need to use our SQL functions when a native XSL one will do:
    <?if:substring(normalize-space(../fsg:ColContext[2]/fsg:ColHeadLine2),1,3)='SEP'?>September<?end if?>
    See that dang normalize space function again ... had to use it on my FSG sample.
    Would it not be easier to either:
    1. Have the FSG generate the September YYYY format or
    2. Have FSG generate XSD date formats, 'YYYY-MM-DD', then you can just specify the date format in the form fields
    Regards, Tim

  • How to process validations using PL/SQL function

    Hi.
    I created a page with a form to process DML operations against a database table. Also created a validation using PL/SQL function that returns a boolean value:
    declare
    v_dummy varchar2(1)
    begin
    select 'X'
    into v_dummy
    from s_customer
    where id = :p2_id;
    return (TRUE);
    exception
    when no_data_found then
    return (FALSE);
    when others
    return (TRUE);
    end;
    In this case i want to send a message to the user indicating that an certain row (the one with :p2_id value) already exists in the database. The piece of code above will do the job. If this function returns true, it means the row is in the DB already.
    The problem is that i don´t know what do to or how to tell htmldb that a TRUE value should issue a message or be processed as en error, whilst a FALSE means OK.
    How do i tell htmldb what to do?
    Suppose must do something with "expression 1" , "expression 2", etc.
    Any ideas???

    Hóla LuÃs,
    when you pick the PL/SQL function body returning a boolean, it implicitly means that TRUE means OK, while FALSE means error, always.
    In order to associate such error to a given form field, you have to go back to the page definiton / validations and specify the name of the item in the corresponding field.
    When you first create the validation rule, this value is not present even if you ask for the error message inline with the field.
    The error message text can be specified in the validation definition, if I am not wrong.
    When you need to return special error messages, including dynamic content for instance, you can use the Function Returning Error Message type, which reports an error when the string returned by the function is not null. This comes in handy when you want to display an item's code, for example, rather than generic text.
    Even in this case, you must go back to the validation and specify the name of the field if you want to see it inline.
    Hope it helps,
    Flavio

  • How to use PL/SQL Function after registering

    Hi,
    I have successfully registered a PL/SQL Function within Discw Admin. But i don't know how to use it further??? Please let me know the steps to use it in folders (admin) or in plus.
    Actually i have a stored procedure which fetches the records from the base tables and i have to develop a report based on that data.
    Please reply ASAP.
    Thanks,
    Jay

    Hi Jay,
    If this function is a stored procedure in the right schema, you can access this function in your custom SQL like any other database functions (e.g. SUM, AVG, MAX, etc).
    If you are not using a custom folder (ie. your own SQL), you can access this function in the workbook (Tools --> Calculations --> New Button --> Select Function Radio Button --> All Functions or Database Folders.). This calculation wil become a new column in the workbook.
    Regards,
    John

  • How do i use PL/SQL function in filter operator

    Hi,
    i want to use one pl/sql function in filter operator. how do i use it in filter condition.
    error i am getting is
    " error occured during expression validatation.
    my filter condition is
    INOUTGRP1.LAST_UPDATE_DATE > "GET_LAST_UPDATE_DATE"()
    can any one suggest me what is the problem for this error.
    Regards,
    Jyothy

    I tried and getting the same error. don't know why!!
    However, There is another way of accomplishing it.
    You can add a "Mapping Input Parameter" to your mapping and in the default value field call the function "Get_Last_Update_date". Then add the output field from this operator to the filter operator. Then edit the filter condition to replace the function call with output value from the Input parameter operator.
    This should work...

  • Discoverer 10g error when scheduling a workbook using 2 calculations

    When I schedule in discoverer 10 g using 2 calculations it return this error ora-01722 Invalid Number
    If I schedule the workbook with only one of the calculation it run perfectly.
    If I run the query manually using the 2 calculations it run perfectly.
    Calculation are created by me and do not have any error in the code
    Same problem occur using DECODE or CASE.
    Please help

    Hi
    this is bug, refer to doc id: 472947.1 in metalink
    you need to download the Patch 6493304.
    regards,
    Jay

  • Using HANA SQL Functions in select list of CDS Views

    Dear Expert,
    Kindly please let me know if we can use the HANA SQL Function (Ex: ADD_DAYS, SECONDS_BETWEEN) in the select list of CDS Views?
    If I create a CDS like below I get error that timestamp is not supported.
    For Example:
    @AbapCatalog.sqlViewName: 'ZMR_H_CA'
    @EndUserText.label: 'CAG A'
    define view viewname
    with parameters start_ts:abap.dec( 15, 0 ) , end_ts:abap.dec( 15, 0 )
    as select from table {
    key resource_key,
    TO_TIMESTAMP(begtstmp) as start_tmp,
    TO_TIMESTAMP(begtstmp) as end_tmp
    where
    (begtstmp > $parameters.start_ts or endtstmp > $parameters.start_ts )
    and
    (begtstmp < $parameters.end_ts or endtstmp < $parameters.end_ts )
    Thanks,
    Giri

    Hi Giri,
    the list of provided features can be found in the ABAP Language Documentation (F1 in the CDS View).
    As CDS in ABAP is abstracted from the database layer, the database features are not directly accessible. That means, you cannot use any HANA or MaxDB feature available. So the answer to your question is no. The reason for this is, that ABAP CDS views can be created on all SAP-supported databases, hence, we can only provide those features, supported by all databases.
    Having said this, there are some exception, e.g. the CDS views with input parameters, which are not supported by all databases. In these cases, you'd have to additionally use the utility class CL_ABAP_DBFEATURES (see http://scn.sap.com/community/abap/blog/2014/10/10/abap-news-for-740-sp08--abap-core-data-services-cds) for more details.
    Best,
      Jasmin

  • How to use Pl/Sql function in Discoverer report

    Hi Everybody,
    Would you be able to provide a workflow/guidance how to use sql function in Discoverer right from creating the function using PLSQL Developer.
    (I am new to Oracle environment... prev. worked as analyst with Microsoft Access... took PL/Sql class in school a few years ago)
    We are using Discoverer Desktop.
    a) Just emailed dba for permission to create pl/sql function.
    b) Recently got Discoverer Administrator installed on my pc.
    can you pls add to the list:
    c)....
    d)....
    etc.?
    tx for your help, sandra

    Hi Kranthi,
    Thx for your warm words....
    The links you provided are great! Thx soooo much!
    Thanks to you and the rest of forum members, am able to use what you've all taught me
    with other Discoverer reports.... so i was able to do more on my own....
    About a month ago, I got access to Discoverer Admin, and was able to paste SQL to create a custom folder.
    Then i joined the custom folder to an existing baseline folder.
    I have found that sometimes when I use calc within a calc when the calcs use analytic functions, that Discoverer
    just displays null in the column. I thought that maybe instead I could create my own function as a work-around.
    I wrote IT for permissions to create views, functions etc. Hopefully, they'll approve and can move toward learning
    pl/sql functions for Discoverer.
    tx again, sandra

  • Parameter passing to custom SQL query using PL/SQL FUNCTION

    Hi
    In order to pass a parameter to the query in custom folder of a business area I created a function and mapped it to the Custome query using Discoverer Desktop. There is no error in mapping as the system does not throw any error. When I am inputting the Parameter for the input values everytime the query doesnot return any rows.
    Can anybody help in this regard

    Hi,
    I need to take the request Id as input from the user and then fetch only the data pertaining to that requet Id. As a lot of complex joins are involved I need to pass request id as parameter to the custome folder.
    The package i greated:
    CREATE OR REPLACE PACKAGE SETPARAM
    AS
    param1 varchar2(25);
    param2 varchar2(25);
    FUNCTION SET_PARAM1(p1 IN varchar2) RETURN NUMBER ;
    FUNCTION GET_PARAM1 RETURN varchar2;
    END SETPARAM;
    CREATE OR REPLACE PACKAGE BODY SETPARAM AS
    FUNCTION SET_PARAM1(p1 IN varchar2) RETURN NUMBER IS
    BEGIN
    fnd_client_info.set_org_context('138');
    param1 := p1;
    dbms_output.put_line(param1);
    RETURN 1;
    END;
    FUNCTION GET_PARAM1 RETURN varchar2 AS
    BEGIN
    RETURN param1;
    END;
    END SETPARAM;
    I registered the set_param1 function as a pl/sql function in discoverer admin.
    This function is called on the condition associated with the parameter in Discoverer Desktop when i run the report.
    In the custom folder query i have this piece in the where clause
    WHERE tnfo.request_id = NVL(APPS.SETPARAM.GET_PARAM1,7383588)
    And everytime i get the data pertaining to request id =7383588,
    Please suggest where i went wrong
    thanks
    Ashwini

  • Error Using LISTAGG SQL Function

    Hello,
    I'm trying to use the new LISTAGG SQL function with the following expression in a report:
    select listagg(email, ';') within group (order by email) as email_list from sba_registration_entries where team=241
    and I get the following SQL error in Apex SQL Workshop:
    ORA-00923: FROM keyword not found where expected
    Is this function enabled on the apex.oracle.com site? Am I using the correct syntax?

    Hi,
    The current database on apex.oracle.com is "Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production"
    The LISTAGG function seems to be from version 11.2: [http://download.oracle.com/docs/cd/E11882_01/server.112/e10592/functions087.htm] ?
    Andy

  • Using PL/SQL Function with CLOB types and a Java Source

    Hi people.
    I have some problems trying to use a function in pl/sql with a CLOB parameter to a java source function.
    Here is the problem: I have to read a TXT file and return a CLOB with the data of the file. The reading is done with a java source function.
    The problem is how to read the file without messing the content and return it to the pl/sql function?
    Another problem: If I pass a CLOB as a parameter to a pl/sql function and have to write the content to a file, how to do it without screwing the EOL chars and so?
    My code is:
    /******** PLSQL FUNCTIONS ********/
    function fn_gravaconteudoarquivo( pv_caminho in varchar2
    , pv_nomearquivo in varchar2
    , pc_conteudo in clob ) return varchar2 as language java
    name 'Importacao.gravaConteudoArquivo(java.lang.String, java.lang.String, oracle.sql.CLOB) return varchar2';
    function fn_lerconteudoarquivoclob( pv_caminho in varchar2
    , pv_nomearquivo in varchar2 ) return clob as language java
    name 'Importacao.lerArquivoClob(java.lang.String, java.lang.String) return clob';
    /******** JAVA SOURCE FUNCTIONS *********/
    public static String gravaConteudoArquivo(String caminho, String nomeArquivo, CLOB conteudo) {
    File file = new File(caminho, nomeArquivo);
    PrintWriter pwFile;
    String mensagem = "";
    StringBuffer sb = new StringBuffer();
    try {
    pwFile = new PrintWriter(new BufferedWriter(new FileWriter(file,true)));
    for (int i=0;i<=(conteudo.length()/32000);i++) {
    sb.append(conteudo.getSubString(conteudo.getLength()+1,32000));
    pwFile.println(sb.substring(0));
    pwFile.close();
    } catch (Exception ex) {
    mensagem = "Erro: "+ex;
    return mensagem;
    public static CLOB lerArquivoClob(String caminho, String nomeArquivo) throws SQLException {
    File file = new File(caminho, nomeArquivo);
    Connection conn;
    CLOB clob = null;
    String lineSep = System.getProperty("line.separator");
    StringBuffer sb = new StringBuffer();
    try {
    Class.forName("oracle.jdbc.driver.OracleDriver");
    conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:csdesv", "csestoque", "liberada");
    clob = CLOB.createTemporary(conn, true, CLOB.DURATION_SESSION);
    BufferedReader brFile = new BufferedReader(new FileReader(file.getPath()));
    while (brFile.ready()) {
    sb.append(brFile.readLine());
    sb.append(lineSep);
    clob.open(CLOB.MODE_READWRITE);
    clob.setString(clob.getLength()+1, sb.toString());
    clob.close();
    } catch (Exception ex) {
    ex.printStackTrace();
    return clob;
    Ah, just remembered... This will work as a JOB.... >.< ... So the connection aparently is at localhost.
    Thanks.

    No one? I really need this....

  • Conditional display using Pl/SQL function body returning a boolean

    I am having issues with conditional display of a report.
    I have to select lists: p50_facility and p50_supervisor.
    I have entered the below pl/sql function body returning a boolean
    Begin
    if (:p50_facility is null or
    :p50_supervisor is null) THEN
    Return False;
    Else
    Return True;
    End if;
    End;
    No matter what values my items are set to (null, not null), the report shows.
    What am I doing wrong?

    Hi,
    The values for the lists will be null only until the first time the page is submitted. Thereafter, the value is likely to be '%null%'
    You will need to 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

  • Out of pure curiosity : is it possible to use a SQL function in a DSV?

    Hi all :)
    out of pure curiosity, I asked myself about this : is it possible using a function in a named query for exemple?
    This is why I would know that : there is a difficult function in the database. I don't want to make a view to use it and to have the table I want. I would use it directly in the dsv, with a named query (or other thing?).
    I thank you a lot by advance.
    (I use SQL Server 2008 :) )
    See you

    Hello,
    In a named query for a Report you can use any valid SQL Statement; so yes, you can use system/user defined functions in your query.
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

Maybe you are looking for

  • Email PO - Has anyone configured the Company Name in the Subject Email?

    Hi experts, I have configured the following in the subject of the email for all of our PO's being sent via email.  PO  &EKKO-EBELN& - &EKKO-BUKRS& This shows the PO Number and the Company Code in the subject line.  My clients do not want the Company

  • Problems with viewing of tv shows

    I have some tv shows, but after synced with iTunes, only some of them will show their name..Why?? I've this problem only with iPad and not with iPhone or iPod...

  • PAP logical database

    Hi, I have used PAP LDB in my report, but when I execute the report it doesn' t show the selection screen of PAP. Also there is nor HR report category tab in the attribute. What might be wrong? Please help. Regards, Anu.

  • Does anyone know why FCPX 10.1.4 quit when I open the inspector window?

    I can open Final cut, do stuff in the Browser and in the Timeline, but when I open the Inspector window, FCPX quit right away... If someone knows why, I would appreciate an answer! Thanks in advance! Here's my cumputer specs:

  • Displaying something other than a list in a JComboBox drop down section

    Dear all, i'd like to be able to put a JTree into a JComboBox drop down section, or at least appear to have done this. has anyone done this or have an idea how this might be achieved? Cheers, Matt