DBAsupport.com Forums - Powered by vBulletin
Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: How to raise a friendly message in pl/sql

  1. #1
    Join Date
    Dec 2001
    Location
    Tel-Aviv,Israel
    Posts
    233

    How to raise a friendly message in pl/sql

    Hi guys,

    One of ours programmers want to raise a friendly message in a procedure.

    for example:
    create or replace produre my_date
    v_date date;
    begin
    select sysdate
    into v_date
    from dual;

    if v_date < '01-jan-05'
    then message('We are still in 2004');
    end if;
    end;
    /

    What should we use for raising this kind of message to the user in the application?

    Thanks in advance,
    Nir

  2. #2
    Join Date
    Jan 2003
    Location
    Hull, UK
    Posts
    220
    What do u mean raise a friendly msg,,,

    do u want to output to the screen or raise kind of an exception.

    Sri

  3. #3
    Join Date
    Dec 2001
    Location
    Tel-Aviv,Israel
    Posts
    233
    Hi Sri,

    I need it as output to the screen.

    Thanks in advance,
    Nir

  4. #4
    Join Date
    Jan 2003
    Location
    Hull, UK
    Posts
    220
    dbms_output.put_line('We are still in 2004');

    Srini

  5. #5
    Join Date
    Dec 2001
    Location
    Tel-Aviv,Israel
    Posts
    233
    Hi,

    Is dbms_output.put_line can be caught by a gui,and pause the program?

    Nir

  6. #6
    Join Date
    Jan 2003
    Location
    Hull, UK
    Posts
    220
    i dont think so...which gui r u using........

  7. #7
    Join Date
    Dec 2001
    Location
    Tel-Aviv,Israel
    Posts
    233
    Ok,

    I've picked more accurate details.
    It's an upgrade program which should be run from a bat file in Windows NT.
    The program check someting in the database and after it finds it,it has to get out to the OS level and print the message there for the field engineer which install the program.
    i need something instead of the RAISE_APPLICATION_ERROR,becuase i don't want to get out from the installation program.

    this is the code:

    DECLARE
    l_ConfigPartition VARCHAR2(255);
    l_GlobalCount1 number;
    l_GlobalCount2 number;
    l_GlobalCount3 number;
    BEGIN
    BEGIN
    Select VALUE
    INTO l_ConfigPartition
    from LC_CONFIG where ID = 3542;
    END;
    IF (l_ConfigPartition = '1') THEN

    -- IF THERE ARE GLOBAL CASE TYPES
    begin
    Select count(PERMISSIONS)
    into l_GlobalCount1
    from CM_CASE_TYPES
    where PERMISSIONS = 0;

    end;

    IF (l_GlobalCount1>0) THEN
    RAISE_APPLICATION_ERROR (-20001, 'The system is configured to use Partitioning but there are some
    Cases/Filters/Phonebook groups defined as Global. Please contact Customer Support.');

    END IF;

    -- IF THERE ARE GLOBAL FILTERS
    begin
    Select count(PERMISSION_TYPE)
    into l_GlobalCount2
    from FILTERS
    where PERMISSION_TYPE = 0;

    end;

    IF (l_GlobalCount2>0) THEN
    RAISE_APPLICATION_ERROR (-20002, 'The system is configured to use Partitioning but there are some
    Cases/Filters/Phonebook groups defined as Global. Please contact Customer Support.');

    END IF;

    -- IF THERE ARE GLOBAL PHONEBOOK GROUPS
    begin
    Select count(PERMISSION)
    into l_GlobalCount3
    from NOI_GROUPS
    where PERMISSION = 0;

    end;
    IF (l_GlobalCount3>0) THEN
    RAISE_APPLICATION_ERROR (-20003, 'The system is configured to use Partitioning but there are some
    Cases/Filters/Phonebook groups defined as Global. Please contact Customer Support.');

    END IF;
    END IF;
    END;
    /

    Thanks in advance,
    Nir

  8. #8
    Join Date
    Jan 2003
    Location
    Hull, UK
    Posts
    220
    Cant u set a out parameter flag for all the 3 conditions

    globalcount1,gc2 and gc3

    and access that flag outside of the program.

    Am i right here ?

    Srini

  9. #9
    Join Date
    Dec 2001
    Location
    Tel-Aviv,Israel
    Posts
    233
    Thanks!

    How can i access those parameters out of the program?
    can you give me an example?

    Thanks in advance,
    Nir

  10. #10
    Join Date
    Jan 2003
    Location
    Hull, UK
    Posts
    220
    Well if its normal VB or any other front end, u can put this in a procedure with the out parameters,,and access those out parameters while calling in the front end.

    but in ur case being a anonymous pl/sql block and running from a DOS batch program, i m not very clear about this.

    sorry if i m not of much help.

    Srini

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width