Error message in compliing a function

Hi All,
I am trying to compiling the following function, but it is throwing the an error.
CREATE OR REPLACE FUNCTION parapage_discosessions
RETURN bumber
IS
discosessions number;
BEGIN
discosessions := select count(*) from gv$session where username IN ('DISCOFIELD', 'DISCOUSER','DISCOADMIN');
RETURN discosessions;
EXCEPTION
WHEN OTHERS THEN
raise_application_error(-20001,'An error was encountered - '||SQLCODE||' -ERROR- '||SQLERRM);
END;
The above function is giving the following error message
Error(9,21): PLS-00103: Encountered the symbol "SELECT" when expecting one of the following: ( - + case mod new not null <an identifier> <a double-quoted delimited-identifier> <a bind variable> avg count current exists max min prior sql stddev sum variance execute forall merge time timestamp interval date <a string literal with character set specification> <a number> <a single-quoted SQL string> pipe <an alternatively-quoted string literal with character set specification> <an alternatively-quo
Please give me any suggestions

SQL> CREATE OR REPLACE FUNCTION parapage_discosessions
  2  RETURN number IS
  3  discosessions number;
  4  BEGIN
  5  select count(*) into discosessions
  6  from gv$session
  7  where username IN ('DISCOFIELD', 'DISCOUSER','DISCOADMIN');
  8  RETURN discosessions;
  9  EXCEPTION
10  WHEN OTHERS THEN
11  raise_application_error(-20001,'An error was encountered - '||SQLCODE||' -ERROR- '||SQLERRM);
12  END;
13  /
Function created

Similar Messages

  • Error message while activating a function

    Hello guys
    I have just written a simple function and am trying to activate it.
    When I click on check button it says 'no syntax error'. However, when I click on activate button, I get the following error. Any feedback on this will be greatly appreciated.
    Error Message:
    =================================
    Function Module ZBAPI_XI
    The main program of the function "ZBAPI_XI" does not begin with
    "FUNCTION-POOL".
    =================================
    Thanks
    Ram

    Hi,
    Try this..
    GO to SE80..
    Give the function group..
    Then activate the main program..
    Thanks,
    Naren

  • How to display error message in case of function module ?

    In the report i was using  " message-id "   to display error message....
    how to use in function module ?

    Hi,
    Messages in Function Modules and Methods
    Messages have two different functions in function modules and methods:
    Normal Messages
    If you use messages in function modules and methods without the RAISING addition in the MESSAGE statement, and the caller does not catch the message, the message is handled
    normally according to the context in which it is called within the function module or method.
    Triggering Exceptions with Messages
    If you use messages in function modules and methods with the addition
    ... RAISING <exc>
    the way in which the message is handled depends on whether the calling program handles the exception <exc> or not.
      If the calling program does not handle the exception, the message is displayed and handled according to the context in which it occurs in the function module or method from which it
    was called.
      If the calling program handles the exception, the message is not displayed. Instead, the procedure is interrupted in accordance with the message type, and processing returns to the calling program. The contents of the message are placed in the system fields SY-MSGID, SY-MSGTY, SY-MSGNO, and SY-MSGV1 to SY-MSGV4.
    Catching Message in the Calling Program
    You can catch messages from function modules that are not sent using the RAISING addition in the MESSAGE statement by including the implicit exception ERROR_MESSAGE in the
    EXCEPTIONS list of the CALL FUNCTION statement. The following conditions apply:
      Type S, I, and W messages are ignored (but logged during background processing)
      Type E and A messages trigger the exception ERROR_MESSAGE
      Type X messages trigger the usual runtime error and short dump.
    Catching messages is not currently supported for methods.
    Regards,
    Bhaskar

  • Display error message in forms from function "verify_function"

    Hi,
    We have a number of users with our own created profile attached to them.
    We have enabled the 'PASSWORD_VERIFY_FUNCTION' for our own profile.
    Function "verify_function" is used to validate a user's password.
    In "verify_function" we have used "raise_application_error" message in case password validation fails.
    Example:
    raise_application_error(-20001,'Password must be minimum 8 characters in length and maximum 30 characters long');Question) "raise_application_error" displays the error message only in SQL Plus prompt. How do I display the same message from Oracle forms?.
    I have used DBMS_ERROR_TEXT & DBMS_ERROR_CODE in ON-ERROR trigger. This is not displaying the error message in forms in case validation failed in "verify_function". Oracle simply clears the username/password field with a new window. We want to display the error message that occured in "verify_function".
    Thanks

    use the following code in validating the item, e.g when-button-pressed
    begin
    verify_function;
    exception
    when others then
    message(sqlerrm);
    raise form_trigger_failure;
    end ;
    OR
    instead of writing a procedure rewrite it as a function to return 1 if password is correct or 0 if password is wrong
    Regards
    Jihad

  • Error message in planning function

    Hi,
    I have implemented a plausibility check for values in a planning function:
    IF { Z6SLSPRIC } = 0 AND NOT {Z6SLSQTY}  IS INITIAL.
         MESSAGE E000(ZOP1) .
         MESSAGE E001(ZOP1).
         MESSAGE I003(ZOP1).
    ENDIF.
    With raising an error message the data will not be saved. Unfortunately the function sends the message '...ended with errors'. I think this is the cas because of raising an error message. How is it possible to raise an error message without getting the function standard message?
    Regards
    Andreas

    Hi,
    I think the syntax is correct. The function works and give the implemented messages without saving the data.
    After that I get the following message: "Planning function Z6OPF4 ( Z6OPF4 ) ended with errors".
    How is it possible to suppress such system messages?
    I think the function is working fine. The message mentioned above is the result of raising an error message in my code...
    Regards
    Andreas

  • The Print function no longer seems to work in Firefox 6. When typing "Control P" or selecting Print from the file menu nothing happens. No error message, no drop down menu, nothing to select. Help!?

    I can't print, print preview, nothing. I have several printers associated with this computer, including an HP, and PDF creator - none of these appear in a drop down menu, there is no error message, yet these all function fine if I am not on the internet!

    No errors in error console. No effect using *. I tried using the dns name of my localhost both in the Firefox URL and in the javascript and I get exactly the same. I have spent a huge amount of time looking into this issue.
    One thing I noticed is that if I use the examples on the internet (http://arunranga.com/examples/access-control/preflightInvocation.html or http://saltybeagle.com/cors/) they work in the same browser. These examples however, are accessed through HTTP proxies.
    I am wondering if the issue has to do with using the same hostname just with different ports.

  • The javascript functions are working correctly, but still get scripting error messages

    When you open or run any javascript functions in this form, error messages pop up, but functions work correctly. Anyone that can help me get rid of error messages? Screenshots are attached.

    can you please share the error messages.

  • Changing the error message

    Hi,
    <br />
    <br />How do I change the error message generated for a function such as an expired login.
    <br />
    <br /> <?php<br /> echo $tNGs->getErrorMsg();<br />?>
    <br />
    <br />Thanks
    <br />
    <br />Laurence

    Hi Laurence,
    ADDT´s error messages are spread across all those XYZ.res.php files located in the includes/resources folder -- and in your case it seems to be the file "tNG_pro.res.php" which provides the error messages related to the login.
    In here you´ll find two message variants : one for ADDT´s "development" mode, and the other for the "production" mode. As you most likely will not need to edit the "development mode" messages which are identified by a trailing "_D" in the variable name
    (e.g. BADWORDS_SQL_ERROR_D), you´ll just need to adapt the "production mode" messages
    (e.g. BADWORDS_SQL_ERROR)
    Cheers
    Günter Schenk
    Adobe Community Expert, Dreamweaver

  • Licence error message when using automation software

    Error message when using Rational Functional Tester 7.0.1.1
    to record a Flex application. The message seemed to come from the
    Flex application.
    I can record a fiew step in the application, then I have the
    message : "Licence are not present. Eith the trial version only
    limited record are allowed". But, my license of my Rational
    Functional Tester application is activated.
    I am using a Flex builder 3 trial version and the trial is
    not over.
    Is there any problem to get the license in the File compiler
    with "D:\apps\IBM\SDP70\FunctionalTester\bin\rft.swc"? That RFT
    file is supposed to be included in the flex application once
    compile

    Does anyone know how to build with automation support in a
    linux environment?
    We simply run an ant script build and have the SDK installed.
    We purchased Flex Builder Professional, but cannot install on Linux
    (we don't want to use the alpha version).
    Thanks for any pointers :)

  • Error : J_2IRG1BAL, Create data processing Function module

    Sap Experts,
    when i go to se11 in which have given table name: J_2IRG1BAL, than i gone menu bar click on utilities select the table contents
    click on create entries button.
    1) Error Message : Create data processing function module
    2) This table Relevant to RG1 Updation
    3) Due to this error I am not able to upload the opening stock of finished material manuaaly
    4) What are the actions need to be done to rectify the above error.
    Regards,
    Prabhakar

    Hi
    Ask your ABAPER to create the maintainence view of the table
    regards
    Sanil Bhandari

  • Error messages help need asap!!!!

    hi this is my code and I need help with what i need to do and how to do it to get rid of the error messages
    CREATE OR REPLACE FUNCTION
    no_of_task_types (x NUMBER)
    RETURN NUMBER IS
    my_val NUMBER;
    BEGIN
    SELECT COUNT(distinct t.task_type_no)
    INTO my_val
    FROM employee e, assignment a, task t
    WHERE e.employee_id = x
    AND e.employee_no = a.employee_no
    AND t.task_id = a.task_id
    RETURN tasktotal;
    END;
    SHOW ERRORS
    these are the error messages:
    Warning: Function created with compilation errors.
    Errors for FUNCTION NO_OF_TASK_TYPES:
    8/1     PL/SQL: SQL Statement ignored
    13/27     PL/SQL: ORA-00933: SQL command not properly ended

    Hi,
    Welcome to the forum!
    Don't say things like "urgent" or "asap" (as in your title, "error messages help need asap!!!!"). It's rude.
    971848 wrote:
    hi this is my code and I need help with what i need to do and how to do it to get rid of the error messages
    CREATE OR REPLACE FUNCTION
    no_of_task_types (x NUMBER)
    RETURN NUMBER IS
    my_val NUMBER;
    BEGIN
    SELECT COUNT(distinct t.task_type_no)
    INTO my_val
    FROM employee e, assignment a, task t
    WHERE e.employee_id = x
    AND e.employee_no = a.employee_no
    AND t.task_id = a.task_id
    RETURN tasktotal;
    END;
    SHOW ERRORS
    these are the error messages:
    Warning: Function created with compilation errors.
    Errors for FUNCTION NO_OF_TASK_TYPES:
    8/1     PL/SQL: SQL Statement ignored
    13/27     PL/SQL: ORA-00933: SQL command not properly endedIt looks like you're missing a semicolon at the end of line 13; that's why the statement beginning at line 8 can't be understood.
    Also, you store a number in my_val, but never use that number, and you have a variable called tasktotal that's never defined. Should my_val and tasktotal be the same variable?
    Perhaps this is what you want:
    CREATE OR REPLACE FUNCTION
           no_of_task_types (x NUMBER)
    RETURN NUMBER IS
        tasktotal   NUMBER;
    BEGIN
        SELECT  COUNT(distinct t.task_type_no)
        INTO    tasktotal
        FROM    employee e, assignment a, task t
        WHERE   e.employee_id = x
        AND     e.employee_no = a.employee_no
        AND     t.task_id        = a.task_id;          -- ; at end is important
        RETURN tasktotal;
    END;
    /This question doesn't have anything to do with SQL*Plus, so maybe the SQL*Plus forum isn't the best place for it. This is strictly a PL/SQL problem; in the future, post questions like this in the PL/SQL. The FAQ page for that forum, {message:id=9360002} , can really help you.

  • Error msg: Unable to execute function 'OBSOLETE' successfully

    i am getting the error message "Unable to execute function 'OBSOLETE' successfully" for a WAIT FOR EVENT workitem. because of this error the folowing steps are not getting executed.
      can anyone help me with this issue.
    cordially,
    sanjay.

    Hi Sanjay,
    Firstly please always tell us which release you are using.
    Secondly, check the Outcomes tab of your wait for event step - you may have turned on the obsolete outcome accidentally.
    Regards,
    Jocelyn

  • CUF error message

    Hello
    We use SRM5.5 (classic scenario).
    We have some customer fields in shopping cart such like drawing #, Tracking #
    And then we use the Check badi to validate this fields
    If User did not input the “drawing #”, system display the error message
    Error message &#61664; “You can not blank drawing#”
    But we got different error message “No items exist; function not possible”
    We didn’t create this message. I think this message is standard error message.
    I confuse why this message is displayed.
    How can we correct the error message?
    Thank you
    Best regards,
    LSH

    Hi,
      For SC,header fields cannot be displayed for the shopping cart. If you define fields on the header, they can only be filled in BADIs.
    BR,
    Disha.

  • Canon MP560. How to override U043 message for using scan function?

    Hi, I've no ink cartridge on my Canon MP560, at the moment.
    How can I override U043 error message for using scan function?
    I tried to push and hold stop button for at least 10 seconds but it didn't work.
    (OS: Windows 7)

    Hello Coz,
    It's been a while since you've posted, I hope you have not given up.  I was having grief with my MF4150 as well, but got it working.  There is a more current driver - search for Mac_UFRII_V230_uk_EN and install it.
    Then, when you go to add your printer through System Preferences > Print & Fax, make sure you click the "default" icon in the top of the dialog.  It should show your Canon MF 4100 series , then use the bottom drop down menu to choose your driver and select Canno MF410 Series UFRII LT (UK) from the list.

  • How to find code responsible  Error Message generated in MIRO transaction

    Hi Gurus,
                    I have to find the code responsible for generating ERROR message in Miro tcode through DEBUGGING. Let me tell you the case...................
    In MIRO,
    We input
    In Basic data tab,
    Invoice Date,
    Posting Date,
    Reference,
    PO no. &
    Tax code as V5 ( VAT @ 8% )  in item data  & then
    In Details tab,
    We enter Business Area    & then
    In Payment Tab
    Baseline date        & then
    In Basic data tab
    We check the check box for Calculate tax &
    entered Amount     & then click entered .
    It displays GREEN button.
    When we click Simulate button & click post then it shows 1 message that " Invoice document still contains messages .".
    And then if we click Messages Button it shows " MSG No. & text -  Enter Bussiness area ."
    So the problem is though we input Business Area , still it shows message Enter Business area.
    So plz tell me how to find that code responsible for error message.

    Ashish- It is because, the error message is called using function module / BAPI. But Ideally when a developer codes to populate the structure of type BAPIRET2, he.she should also follow the following rule, to make the message traceable:
    "Populate BAPI structure for error message
    "Following code will not get called, but is for documentation for traceability.
    if 1 = 2.
      message e004.
    endif.
    That is why i said in my comment, if it is "coded properly" then we will be able trace
    Bottom line: you will not be able to find the program line using this approach.
    But now since you now the error message and number, you can go to the underlying program of MIRO (SAPLMR1M and SAPLFDCB)..click on the find button on the application toolbar, enter the message# and find..PLEASE SELECT THE RADIO BUTTON "In the main program".
    Hope this helps.
    Sajan Joseph.

Maybe you are looking for

  • Waking up after closing display (lid)

    The problem I am having with my waking PB only happens when I close the display. If I use the sleep command in the menu and don't close the display all the way, my PB stays asleep. If I close the lid all the way, it will eventually wake up and stay a

  • R12 - Multiple programs to be submitted in supplier remittance and bank trf

    in 11i, the AP payment programs was set up such that a custom SQL program is triggered during "Bank Transfer" and "Supplier Remittance" processes The custom SQL program has a logic to submit multiple reports for each process. E.g. Supplier remittance

  • Where's the metadata for STORE IN clause of a table with partition?

    Hi Experts, I created a table with a range-interval partition with STORE IN clause. It's definition: CREATE TABLE interval_part ( person_id NUMBER(5) NOT NULL, first_name VARCHAR2(30), last_name VARCHAR2(30)) PARTITION BY RANGE (person_id) INTERVAL (

  • How do I stop Adobe from overwriting my font format when I enable data in my form?

    I'm using Adobe X but I also have access to Adobe 8. When I save my form with updated format (I change the input size in my form to Helvetica 10) it defaults back to Times New Romans 8 when I test it in Reader. Does anyone have any solutions? I'm stu

  • Screen variant for Fb60

    Hello People, Can Anyone help me with screen variants for transaction FB60. Actually i want to make the field Business place/Section  as mandatory. I tried creating screen variants .But The checkbox for making the field required is greyed out. Can an