Dbms_output.put_line(v_boolean);

I have 10.2.0.1.0 on Windows XP.
Does 10g offers a handy function to print out boolean, such as dbms_output.put_line(v_boolean)?
Thanks

782150 wrote:
I have 10.2.0.1.0 on Windows XP.
Does 10g offers a handy function to print out boolean, such as dbms_output.put_line(v_boolean)?Nope.
How about this?
dbms_output.put_line(CASE WHEN v_boolean THEN 'TRUE' ELSE 'FALSE' END);as you can see below:
SQL> set serveroutput on
SQL> declare
  2   v_boolean BOOLEAN := TRUE;
  3  BEGIN
  4   dbms_output.put_line(CASE WHEN v_boolean THEN 'TRUE' ELSE 'FALSE' END);
  5   v_boolean := FALSE;
  6   dbms_output.put_line(CASE WHEN v_boolean THEN 'TRUE' ELSE 'FALSE' END);
  7  end;
  8  /
TRUE
FALSE
PL/SQL procedure successfully completed.

Similar Messages

  • DBMS_OUTPUT.PUT_LINE multi records from PL/SQL procedure to Java web page.

    Hello
    I will explain the scenario:
    In our java web page, we are using three text boxes to enter "Part number,Description and Aircraft type". Every time the user no need to enter all these data. The person can enter any combination of data or only one text box. Actually the output data corresponding to this input entries is from five Oracle table. If we are using a single query to take data from all the five tables, the database will hang. So I written a procedure "SEARCH1",this will accept any combination of values (for empty values we need to pass NULL to this procedure) and output data from all the five tables. When I executing this procedure in SQL editor, the execution is very fast and giving exact result. I used "dbms_output.put_line" clause for outputing multiple records in my procedure. The output variables are "Serial No, part Number, Description, Aircraft type,Part No1,Part No2,Part No3,Part No4". I want to use the same procedure "SEARCH1" for outputing data in java web page.The passing argument I can take from the text box provided in java web page. I am using jdbc thin driver to connect our java web page to Oracle 9i database.
    Note1 : If any combination of search item not available, in procedure itself I am outputing a message like "Part Number not found". Here I am using four words ("Part" is the first word,"Number" is the second,"Not" s the third, and "found" is the fourth) for outputing this message.Is it necessary to equalise number of words I am using here to the record outputing eight variable?
    Our current development work is stopped because of this issue. So any one familier in this field,plese help me to solve our issue by giving the sample code for the same scenario.
    My Email-id is : [email protected]
    I will expect yor early mail.
    With thanks
    Pramod kumar.

    Hello Avi,
    I am trying to solve this issue by using objects. But the following part of code also throwing some warning like "PLS-00302: component must be declared". Plese cross check my code and help me to solve this issue.
    drop type rectab;
    create or replace type rectype as object(PartNo varchar2(30),Description varchar2(150),AIrcraft_type varchar2(15),status_IPC varchar2(30),status_ELOG varchar2(30),status_SUPCAT varchar2(30),status_AIRODWH varchar2(30));
    create or replace type rectab as table of rectype;
    create or replace package ioStructArray as
    procedure testsch2(pno in varchar2,pdes in varchar2,air in varchar2,orec in out rectab);
    end ioStructArray;
    create or replace package body ioStructArray as
    procedure testsch2(pno in varchar2,pdes in varchar2,air in varchar2,orec in out rectab) is
    mdescription varchar2(150);
    mpartnum varchar2(30);
    mpno varchar2(30);
    mdes varchar2(150);
    mair varchar2(15);
    mstat varchar2(1);
    cursor c1 is select partnum,description,aircraft_type from master_catalog where partnum=mpno and aircraft_type=mair and description like ltrim(rtrim(mdes))||'%';
    cursor c2 is select partnum from ipc_master where partnum=mpartnum;
    cursor c3 is select partnum from fedlog_data where partnum=mpartnum;
    cursor c4 is select partnum from superparts where partnum=mpartnum;
    cursor c5 is select part_no from supplier_catalog where part_no=mpartnum;
    mpno1 varchar2(30);
    mpno2 varchar2(30);
    mpno3 varchar2(30);
    mpno4 varchar2(30);
    mpno5 varchar2(30);
    maircraft_type varchar2(15);
    mstat1 varchar2(30);
    mstat2 varchar2(30);
    mstat3 varchar2(30);
    mstat4 varchar2(30);
    begin
    mstat:='N';
    mpno:=pno;
    mdes:=pdes;
    mair:=air;
    if mpno is not null and mdes is not null and mair is not null then
    begin
    mstat:='N';
    mpno:=pno;
    mdes:=pdes;
    mair:=air;
    for i in c1 loop
    mstat:='N';
    mstat1:='N';
    mstat2:='N';
    mstat3:='N';
    mstat4:='N';
    mpno1:=i.partnum;
    mpartnum:=i.partnum;
    mdescription:=i.description;
    maircraft_type:=i.aircraft_type;
    for j in c2 loop
    mpno2:=j.partnum;
    end loop;
    for k in c3 loop
    mpno3:=k.partnum;
    end loop;
    for l in c4 loop
    mpno4:=l.partnum;
    end loop;
    for m in c5 loop
    mpno5:=m.part_no;
    end loop;
    if mpno2=mpartnum then
    mstat1:=mpno2;
    end if;
    if mpno3=mpartnum then
    mstat2:=mpno3;
    end if;
    if mpno4=mpartnum then
    mstat3:=mpno4;
    end if;
    if mpno5=mpartnum then
    mstat4:=mpno5;
    end if;
    if mpno1=mpartnum then
    mstat:='Y';
    orec.PartNo:=mpno1;
    orec.Description:=mdescription;
    orec.AIrcraft_type:=maircraft_type;
    orec.status_IPC:=mstat1;
    orec.status_ELOG:=mstat2;
    orec.status_SUPCAT:=mstat3;
    orec.STATUS_AIRODWH:=status_AIRODWH;
    end if;
    end loop;
    end;
    end if;
    end testsch2;
    end ioStructArray;
    Expecting your early reply.
    With thanks
    Pramod kumar.

  • Dbms_output.put_line not printing in inner for loop using a parameter

    I cannot get the inner loop to print output. I can run both loops independent (hardcoding a value for the inner loop) Any help is apprecicated... Listed is the code
    set serveroutput on
    DECLARE
    cursor ACCNO_CUR is
    select accession_number from didb_studies where insert_time > to_date('02-JUN-12');
    cursor PATH_CUR (p1_accno VARCHAR2) is
    select distinct l.FILE_SYSTEM || '/' ||
    substr(LPAD(s.PATIENT_DB_UID, 12, '0'),1,3) || '/' ||
    substr(LPAD(s.PATIENT_DB_UID, 12, '0'),4,3) || '/' ||
    substr(LPAD(s.PATIENT_DB_UID, 12, '0'),7,3) || '/' ||
    substr(LPAD(s.PATIENT_DB_UID, 12, '0'),10,3) || '/' ||
    s.STUDY_DB_UID || '/' || i.SERIES_DB_UID || '/'||
    i.RAW_IMAGE_DB_UID || '.img' as FULLY_QUALIFIED_IMAGE_NAME
    , l.image_size
    , i.image_need_backup
    , i.sop_class_uid
    from medistore.didb_studies s
    , medistore.didb_raw_images_table i
    , medistore.didb_image_locations l
    where s.accession_number = 'p1_accno'
    and s.study_db_uid = i.study_db_uid
    and i.raw_image_db_uid = l.raw_image_db_uid
    and l.file_system is not null and INSTR(l.file_system, '.img') = 0
    UNION
    select distinct(l.FILE_SYSTEM) as FULLY_QUALIFIED_IMAGE_NAME
    , l.image_size
    , i.image_need_backup
    , i.sop_class_uid
    from medistore.didb_studies s, medistore.didb_raw_images_table i,
    medistore.didb_image_locations l
    where s.accession_number = 'p1_accno'
    and s.study_db_uid = i.study_db_uid
    and i.raw_image_db_uid = l.raw_image_db_uid
    and l.file_system is not null and INSTR(l.file_system, '.img') > 0
    order by 1;
    BEGIN
    FOR accno_rec in accno_cur LOOP
    DBMS_OUTPUT.put_line('ACCESSION_NUMBER is: '|| accno_rec.accession_number);
    FOR path_rec in path_cur(accno_rec.accession_number) LOOP
    DBMS_OUTPUT.put_line('Inner loop accession_number is :'||accno_rec.accession_number);
    DBMS_OUTPUT.put_line('Full path is : ' || path_rec.FULLY_QUALIFIED_IMAGE_NAME);
    END LOOP;
    END LOOP;
    END;

    Maybe
    DECLARE
      cursor ACCNO_CUR is
        select accession_number
          from didb_studies
         where insert_time > to_date('02-JUN-12');
      cursor PATH_CUR (p1_accno VARCHAR2) is
        select distinct
               l.FILE_SYSTEM || '/' ||
               substr(LPAD(s.PATIENT_DB_UID, 12, '0'),1,3) || '/' ||
               substr(LPAD(s.PATIENT_DB_UID, 12, '0'),4,3) || '/' ||
               substr(LPAD(s.PATIENT_DB_UID, 12, '0'),7,3) || '/' ||
               substr(LPAD(s.PATIENT_DB_UID, 12, '0'),10,3) || '/' ||
               s.STUDY_DB_UID || '/' || i.SERIES_DB_UID || '/'||
               i.RAW_IMAGE_DB_UID || '.img' as FULLY_QUALIFIED_IMAGE_NAME,
               l.image_size,
               i.image_need_backup,
               i.sop_class_uid
          from medistore.didb_studies s,
               medistore.didb_raw_images_table i,
               medistore.didb_image_locations l
         where s.accession_number = to_number(p1_accno) /* to_char(s.accession_number) = p1_accno */
           and s.study_db_uid = i.study_db_uid
           and i.raw_image_db_uid = l.raw_image_db_uid
           and l.file_system is not null
           and INSTR(l.file_system, '.img') = 0
        UNION
        select distinct
               l.FILE_SYSTEM as FULLY_QUALIFIED_IMAGE_NAME,
               l.image_size,
               i.image_need_backup,
               i.sop_class_uid
          from medistore.didb_studies s,
               medistore.didb_raw_images_table i,
               medistore.didb_image_locations l
         where s.accession_number = to_number(p1_accno) /* to_char(s.accession_number) = p1_accno */
           and s.study_db_uid = i.study_db_uid
           and i.raw_image_db_uid = l.raw_image_db_uid
           and l.file_system is not null and INSTR(l.file_system, '.img') > 0
         order by 1;
    BEGIN
      FOR accno_rec in accno_cur
      LOOP
        DBMS_OUTPUT.put_line('ACCESSION_NUMBER is: '|| accno_rec.accession_number);
        FOR path_rec in path_cur(accno_rec.accession_number)
        LOOP
          DBMS_OUTPUT.put_line('Inner loop accession_number is :'||accno_rec.accession_number);
          DBMS_OUTPUT.put_line('Full path is : ' || path_rec.FULLY_QUALIFIED_IMAGE_NAME);
        END LOOP;
      END LOOP;
    END;Regards
    Etbin

  • How to Populate a table with DBMS_OUTPUT.put_line

    Hey Guys, it's Xev.
    Please only pleasant people reply to this.
    I have a PL/SQL Program that searches for strings and then at the end of it it prints out to DBMS_OUTPUT.put_line.
    I have the owner, the table_name, the column name and the count, then it goes to DBMS_OUTPUT.put_line
    What i want to do, is take the results of DBMS_OUTPUT.put_line and insert it into a table.
    Here is the script I am talking about, as you can see it's simple, yet for me it works.  I want to take the results of this and insert it into a table. How can i do  that??
    set serveroutput on size unlimited
    execute DBMS_OUTPUT.ENABLE (buffer_size => NULL);
    DECLARE
       FND_GOVIDS       INTEGER;
       BEGIN
    FOR t  IN (SELECT owner, table_name, column_name
                FROM all_tab_columns
                WHERE owner = upper('&SCHEMA_NAME'))
    LOOP
      BEGIN
        EXECUTE IMMEDIATE 'with a as ( select  case when REGEXP_LIKE(' || t.column_name ||
    --This searches for 8 Alpha Digits
    ',''^([[:alpha:]]{2}|[[:alpha:]]{4})?[ ]?[0-9]{8}[ ]?([[:alpha:]]{2}|[[:alpha:]]{4})?$'')
    then ''Match Found''
    else ''No Match Found'' end as output from ' || t.owner || '.' || t.table_name || ')
    select count(*) from a where a.output=''Match Found'' '
          INTO FND_GOVIDS ;
    IF FND_GOVIDS > 0         THEN
    DBMS_OUTPUT.put_line (
    t.owner
    || '.'
    || t.table_name
    || ' '
    || t.column_name
    || ' '
    || FND_GOVIDS);
      END IF;
      EXCEPTION
        WHEN OTHERS
          THEN
          DBMS_OUTPUT.put_line (
          'Generic Error '
          || t.column_name
          || ' from '
          || t.owner
          || '.'
          || t.table_name);      
          END;
       END LOOP;
    END;

    Nope, the table is empty....
    But it ran without error??!?! Wait a minute, I think i have to commit right? Since it's not straight sql, ok, that's what I am going to try..
    set serveroutput on size unlimited
    execute DBMS_OUTPUT.ENABLE (buffer_size => NULL);
    DECLARE
       FND_GOVIDS       INTEGER;
       BEGIN
    FOR t  IN (SELECT owner, table_name, column_name
                FROM all_tab_columns
                WHERE owner = upper('&SCHEMA_NAME'))
    LOOP
      BEGIN
        EXECUTE IMMEDIATE 'with a as ( select  case when REGEXP_LIKE(' || t.column_name ||
    --This searches for 6 Alpha Digits
    ',''^([[:alpha:]]|[[:alpha:]]{3})[0-9]{6}$'')
    then ''Match Found''
    else ''No Match Found'' end as output from ' || t.owner || '.' || t.table_name || ')
    select count(*) from a where a.output=''Match Found'' '
          INTO FND_GOVIDS ;
    /*Table insert for resulting */
    IF FND_GOVIDS > 0 THEN
    INSERT INTO "SMEG"."DYNAMIC_COUNTS" (T_OWNER, T_TABLE_NAME, T_COLUMN_NAME, FND_GOVIDS) VALUES
    ('t.owner','t.table_name','t.column_name','FND_GOVIDS');
      END IF;
    /* dbms_output */
    IF FND_GOVIDS > 0 THEN
    DBMS_OUTPUT.put_line (t.owner || '.' || t.table_name || ' ' || t.column_name || ' ' || FND_GOVIDS);
      END IF;
    /* Exception Handeling */
      EXCEPTION
        WHEN OTHERS
          THEN
          DBMS_OUTPUT.put_line (
          'Generic Error '
          || t.column_name
          || ' from '
          || t.owner
          || '.'
          || t.table_name);     
          END;
       END LOOP;
    END;

  • Oracle 10.1.0.4.2 SQL Plus dbms_output.put_line not working

    I am using Oracle 10.1.0.4.2 SQL Plus, and dbms_output.put_line is not working. It returns the dbms_output ONLY from outside the procedure. I have dbms_output INSIDE my procedure, and none of it gets returned. Please help!
    Here is what I enter:
    set serveroutput on size 1000000;
    DECLARE
         x number:=0;
    begin
    DBMS_OUTPUT.ENABLE;
    c2reports.c2proc(x,'TEST');
    DBMS_OUTPUT.PUT_LINE('testX');
    END;
    testX
    There should be more besides the 'testX' that gets returned. The first line in my procedure has output code to print testY. Thanks in advance!

    This is the forum for the Oracle's SQL Developer (Not for general SQL/PLSQL questions). You should ask question like this in the PL/SQL forum

  • Printing messages in Log File and Output File using Dbms_output.put_line

    Hi,
    I have a requirement of printing messages in log file and output file using dbms_output.put_line instead of fnd_file.put_line API.
    Please let me know how can I achieve this.
    I tried using a function to print messages and calling that function in my main package where ever there is fnd_file.put_line. But this approach is not required by the business.
    So let me know how I can achieve this functionality.
    Regards
    Sandy

    What is the requirement that doesn't allow you using fnd_file.put_line?
    Please see the following links.
    https://forums.oracle.com/forums/search.jspa?threadID=&q=Dbms_output.put_line+AND+Log+AND+messages&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
    https://forums.oracle.com/forums/search.jspa?threadID=&q=%22dbms_output.put_line+%22+AND+concurrent&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
    Thanks,
    Hussein

  • How to print extract value in dbms_output.put_line

    CREATE OR REPLACE PROCEDURE pr_srch_data
    AS
    xml_data_val xmltype:=null;
    vPropertyName clob;
    vstr varchar2(1000);
    operation varchar2(1000);
    vQuery VARCHAR2(4000):=NULL;
    vQry VARCHAR2(4000):=NULL;
    vPartyid VARCHAR2(2000):=NULL;
    vPerson varchar2(4000);
    BEGIN
    FOR I IN (SELECT EAPP_XML_DATA
    FROM binary_xml
    WHERE extractvalue(eapp_xml_data,'/OLifE/Party[@id="Party1"]/Person/LastName') Like 'Rajesh%'
    LOOP
    BEGIN
         SELECT extractvalue(value(t),'/Relation/@RelatedObjectID')
         INTO vPartyid
         FROM TABLE (XMLSEQUENCE (EXTRACT (xml_data_val,'/OLifE/Relation'))) t
         WHERE extractvalue(value(t),'/Relation/RelationRoleCode')='Owner'
    AND existsnode(value(t),'/Relation/@RelatedObjectID')=1 ;
    END;
    SELECT extract(value(t),'/OLifE/Party[@id='''||vPartyid ||''']/Person')
    INTO vPerson
    FROM TABLE (XMLSEQUENCE (EXTRACT (I.EAPP_XML_DATA,'/OLifE')))t;
    dbms_output.put_line('vPerson'||'--'||vPerson);
    END LOOP;
    END;
    But when i am printing vPerson i am getting error. I need to print that extract value.

    Things to remember (that you should know by now)
    Please remind us of which version of 11g you are using in this post and all future posts.
    Look at the FAQ under your sign-in name to see how to use the tag to retain formatting of your code as you have seen our examples to you look like.
    We can't see your screen or your data so how about the error message and some data from your table?
    Please start using either XMLTable or XMLCast/XMLQuery as odie_63 as shown you.
    What are you trying to do?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Output variable value (DBMS_OUTPUT.PUT_LINE)

    Hello,
    I just started using ORACLE and am learning about PL/SQL. My question is how do you output a variable? I am running the following in an SQL Worksheet, but I can't output the value:
    DECLARE
    v_Temp VARCHAR2(200);
    BEGIN
    v_Temp :='help me';
    DBMS_OUTPUT.PUT_LINE(v_Temp);
    DBMS_OUTPUT.PUT_LINE('Text In Single');
    END;
    Thanks, sck10

    SQL> DECLARE
      2  v_Temp VARCHAR2(200);
      3 
      4  BEGIN
      5  v_Temp :='help me';
      6  DBMS_OUTPUT.PUT_LINE(v_Temp);
      7  DBMS_OUTPUT.PUT_LINE('Text In Single');
      8  END;
      9  /
    PL/SQL procedure successfully completed.
    SQL> set serveroutput on
    SQL> /
    help me
    Text In Single
    PL/SQL procedure successfully completed.
    SQL> Nicolas.

  • Pro*Cobol and DBMS_OUTPUT.PUT_LINE

    I am new to Pro*Cobol and had a simple question (I hope).
    I have a stored proc that contains DBMS_OUTPUT.PUT_LINE stmts
    and I can see those in SQLPlus (when serveroutput=on), but I do
    not see them when I call it from Pro*Cobol. Is there a
    precompiler setting or something I need to set?

    'Far as I know, you'll have to repeatedly call
    dbms_output.get_line in your Pro*Cobol program to
    get the server output generated by your stored procedure.
    Hope that helps.
    All the best
    Michael

  • Usage of DBMS_OUTPUT.PUT_LINE degrade performance?

    Does multiple usage of DBMS_OUTPUT.PUT_LINE in a procdure degrade performance OR crash the procedure?

    [url http://forums.oracle.com/forums/thread.jspa?threadID=490999&tstart=0]duplicate thread

  • DBMS_OUTPUT.PUT_LINE

    Hello I need a Help.
    I use PHP Version 4.4.0 and Oracle 10g
    I have create this procedure with php
    $node_start = 670;
    $node_end = 677;
    $conn = @OCILogon("My_db", "My_pass", "My_host") or die ( "Connect KO to server <b>$My_host</b>!");
    $plsql = "create or replace PROCEDURE PERCORSOSTRADA AS "
    ." path_id NUMBER;"
    ." res_numeric NUMBER;"
    ." res_array SDO_NUMBER_ARRAY;"
    ." indx NUMBER;"
    ." BEGIN"
    ." sdo_net_mem.network_manager.read_network('SDO_RETE_STRADALE', 'FALSE');"
    ." path_id := sdo_net_mem.network_manager.shortest_path('SDO_RETE_STRADALE', $node_start, $node_end);"
    ." res_array:= sdo_net_mem.path.get_node_ids('SDO_RETE_STRADALE', path_id);"
    ." DBMS_OUTPUT.PUT('This path has the following nodes: ');"
    ." FOR indx IN res_array.FIRST..res_array.LAST"
    ." LOOP"
    ." DBMS_OUTPUT.PUT(res_array(indx) || ' ');"
    ." END LOOP;"
    ." DBMS_OUTPUT.PUT_LINE(' ');"
    ." res_array:= sdo_net_mem.path.get_link_ids('SDO_RETE_STRADALE', path_id);"
    ." DBMS_OUTPUT.PUT('This path has the following links: ');"
    ." FOR indx IN res_array.FIRST..res_array.LAST"
    ." LOOP"
    ." DBMS_OUTPUT.PUT(res_array(indx) || ' ');"
    ." END LOOP;"
    ." DBMS_OUTPUT.PUT_LINE(' ');"
    ." END PERCORSOSTRADA;"
    $s = OCIParse($conn, $plsql);
    $istruzione = @OCIExecute($s);
    This procedure run successfully
    If I use sql*plus I have this result
    -This path has the following nodes: 670 674 673 676 677
    -This path has the following links: 824 818 2925 874
    What I must to do for have the same result using a script php?
    I have tried to read The Underground PHP and Oracle® Manual Release 1.4
    of CHRISTOPHER JONES AND ALISON HOLLOWAY
    but I am not able to find the right way.
    Thank you in advance!
    Edited by: angelo_z on Sep 8, 2008 12:34 PM

    Excuse me but I don't understand what I must to do after created this procedure: PERCORSOSTRADA
    $node_start = 670;
    $node_end = 677;
    $conn = @OCILogon("My_db", "My_pass", "My_host") or die ( "Connect KO to server $My_host!");
    $plsql = "create or replace PROCEDURE PERCORSOSTRADA AS "
    ." path_id NUMBER;"
    ." res_numeric NUMBER;"
    ." res_array SDO_NUMBER_ARRAY;"
    ." indx NUMBER;"
    ." BEGIN"
    ." sdo_net_mem.network_manager.read_network('SDO_RETE_STRADALE', 'FALSE');"
    ." path_id := sdo_net_mem.network_manager.shortest_path('SDO_RETE_STRADALE', $node_start, $node_end);"
    ." res_array:= sdo_net_mem.path.get_node_ids('SDO_RETE_STRADALE', path_id);"
    ." DBMS_OUTPUT.PUT('This path has the following nodes: ');"
    ." FOR indx IN res_array.FIRST..res_array.LAST"
    ." LOOP"
    ." DBMS_OUTPUT.PUT(res_array(indx) || ' ');"
    ." END LOOP;"
    ." DBMS_OUTPUT.PUT_LINE(' ');"
    ." res_array:= sdo_net_mem.path.get_link_ids('SDO_RETE_STRADALE', path_id);"
    ." DBMS_OUTPUT.PUT('This path has the following links: ');"
    ." FOR indx IN res_array.FIRST..res_array.LAST"
    ." LOOP"
    ." DBMS_OUTPUT.PUT(res_array(indx) || ' ');"
    ." END LOOP;"
    ." DBMS_OUTPUT.PUT_LINE(' ');"
    ." END PERCORSOSTRADA;"
    $s = OCIParse($conn, $plsql);
    $istruzione = @OCIExecute($s);
    I have not clear next steps.
    I'm doing this:
    function SetServerOutput($conn, $p)
    if ($p)
    $s = "BEGIN DBMS_OUTPUT.ENABLE(NULL); END;";
    else
    $s = "BEGIN DBMS_OUTPUT.DISABLE(); END;";
    $s = OCIparse($conn_obgeo, $s);
    $r = OCIexecute($s);
    OCIfreestatement($s);
    return $r;
    function GetDbmsOutput($conn)
    $res = false;
    $s = OCIparse($conn_obgeo, "BEGIN DBMS_OUTPUT.GET_LINE(:LN, :ST); END;");
    if (ocibindbyname($s, ":LN", $ln, 255) &&
    ocibindbyname($s, ":ST", $st)) {
    $res = array();
    while (($succ = ociexecute($s)) && !$st)
    $res[] = $ln;
    if (!$succ)
    $res = false;
    ocifreestatement($s);
    return $res;
    SetServerOutput($conn, true);
    // Create some output
    $s = ociparse($conn_obgeo, "call dbms_output.put_line('Hello, world!')");
    ociexecute($s);
    // Display the output
    $output = GetDbmsOutput($conn);
    foreach ($output as $line)
    echo "$line<br>";
    But What I must to do, what I must write instead of 'Hello, world!'?
    I must create a function myfunc?
    $plsql_fun = "create or replace package mypack AS "
    ." function myfunc(i_p in number) return varchar2;"
    ." end mypack;"
    $s = OCIParse($conn, $plsql_fun);
    $istruzione = @OCIExecute($s);
    and then I must call procedure?
    $call_procedura = OCIParse($conn, "call PERCORSOSTRADA()");
    OCIexecute($call_procedura);
    and then ???
    $stmt = OCIparse($conn, "begin :ret := mypack.myfunc(); end;");
    OCIbindbyname($stmt, ':ret', $r, 20);
    OCIexecute($stmt);
    echo "Name is: ".$r;
    Thank you in advance!

  • Dbms_output.put_line does not write to stdout

    I expect the following code to fail and to write 'ERRORE' to stdout:
    ------------------- mm.sql
    set serveroutput on
    BEGIN
    select 1/0 from dual;
    exception
    when others then
    dbms_output.put_line('ERRORE');
    END;
    I execute this from the command line
    sqlplus rmsas_test/rmsas_test < mm.sql > mm.log 2>&1
    It produces
    ---------------------------- mm.log
    SQL*Plus: Release 9.2.0.6.0 - Production on Gio Lug 13 16:42:27 2006
    Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
    Connected to:
    Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
    JServer Release 9.2.0.6.0 - Production
    SQL> SQL> 2 3 4 5 6 7 Disconnected from Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
    JServer Release 9.2.0.6.0 - Production
    But no 'ERRORE' has been written to stdout????
    Why?
    Thanks
    Mauro

    Just a comment. There are no STDOUT or STDERR devices when dealing with PL/SQL programs.
    The code runs inside an Oracle server process. That process itself is detached from any display device, any input device (e.g. mouse or keyboard) and any peripheral device (e.g. printer).
    DBMS_OUTPUT is simply a persistant PL/SQL buffer that can be created in an Oracle session. The contents of this buffer can be displayed by a client (using the DBMS_OUTPUT API to read and clear the buffer). Do not confuse it with a proper STDOUT/STDERR device.

  • SQl Developer  2.1.0.62 - dbms_output.put_line

    When trying to use dbms_output.put_line i seem to keep on getting messages in the logging Page tab and example would be:
    SEVERE     96     516     oracle.dbtools.db.DBUtil     Invalid column index
    This even seems to happen when doing a simple anonymous block witha single dbms_output.put_line command.
    I have tried closing SQL Developer and using a new session but same issue.
    Is this an install issue or something else?

    Dermot,
    I too am running on XP.
    I am running against a 9i DB in case that should make any difference.
    I have as a test switched back to my SQL Developer 1.5.5.59.69 version issued a dbms_output call from a block and it works.
    All i am doing is logging on to 9i DB
    Opening worksheet
    begin
    dbms_output.put_line('Test');
    END;
    I have then chosen View -> DBMS Output
    This then open a new a new window at bottom of screen, i then click on the cross to add a new DBMS Output window for my connection.
    I then run the code, this is where i now receive the messages in the Loggng Tab.
    Have just noticed that when i log into the 9i DB i receive the following in the looging Tab:
    SEVERE     103     26830     oracle.dbtools.db.DBUtil     ORA-02248: invalid option for ALTER SESSION
    Not sure what is causing this must be part of SQl developer Login procedure failing, but doesn't happen in vesrion 1.5.5.59.69
    Thanks
    Paul
    Edited by: Trotty on Sep 25, 2009 3:44 PM
    Edited by: Trotty on Sep 25, 2009 3:56 PM

  • Dbms_output.put_line not displaying anything

    I am running the below code (ssn_run.sql) using sqlplus 10.2.0.1.0 on my windows XP professional client PC.
    The database is a Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit running on Solaris
    I cracked my head for about one hour but couldn't figure out this :
    accept input_ssn prompt 'Enter SSN :'
    set feedback on
    set serveroutput on
    set echo on
    set term on
    set heading on
    set pagesize 0
    set linesize 10000
    set verify on
    undefne sdate input_ssn
    col sdate new_value sdate
    col input_ssn new_value input_ssn
    select to_char(sysdate,'YYYYMMDD') sdate from dual;
    spool C:\PERSON_DATA_&&sdate._&&input_ssn..TXT
    select 'REPORT GENERATED ON : '||SYSDATE FROM DUAL;
    begin
    select personid into v_personid from person where SIN = '&&input_ssn';
    INSERT INTO PERSON_OLD
    (PERSONID, TITLE, FNAME, MNAME, LNAME, ACFM, SIN, UNAME, AKANAME, DCFM,
    IROWID, SUFFIX, PTYPE, OLD_SSN)
    SELECT PERSONID, TITLE, FNAME, MNAME, LNAME, ACFM, SIN, UNAME,
    AKANAME, SIN FROM PERSON WHERE SIN = '&&input_ssn';
    INSERT INTO MEMBER_OLD
    (CLNT, MKEY, PERSONID, MEMNO, OLD_MEMNO)
    SELECT CLNT, MKEY, PERSONID, MEMNO,MEMNO
    FROM MEMBER WHERE PERSONID IN(SELECT PERSONID FROM PERSON WHERE SIN = '&&input_ssn');
    UPDATE PERSON SET FNAME = TRANSLATE(SIN,'0123456789','ACEGIKMOQS'),
    LNAME = TRANSLATE(SIN,'0123456789','SQOMKIGECA'),
    UNAME = TRANSLATE(SIN,'0123456789','ACEGIKMOQS')||' '||TRANSLATE(SIN,'0123456789','SQOMKIGECA'),
    AKANAME=NULL WHERE SIN = '&&input_ssn';
    UPDATE MEMBER SET MEMNO = MKEY WHERE PERSONID IN(SELECT PERSONID FROM PERSON WHERE SIN = '&&input_ssn');
    for i in(select personid person_other from person_relation where relpersonid in(select personid from
    person where PERSONID = v_personid))
    loop
    dbms_output.put_line('i.person_other is : '||i.person_other);
    UPDATE MEMBER SET MEMNO = MKEY WHERE PERSONID = i.person_other;
    end loop;
    EXCEPTION
    WHEN OTHERS THEN
         ecode := SQLCODE;
         emesg := SQLERRM;
         dbms_output.put_line('Error while data scrubbing: Error code is : ' || ' - ' || ecode);
         dbms_output.put_line('Error message is :' || ' - ' || emesg);
    end;
    spool off;
    set term on
    set feedback on
    set HEADING on
    set verify on
    --End of code
    The SELECT statement that comes in the for loop should return data as v_personid has a value. (I tested this by a select statement)
    However, I am just not able to display the line which comes in the inner loop :
    dbms_output.put_line('i.person_other is : '||i.person_other);
    The result of this dbms output put_line neither shows up on the screen, nor it gets written to the spool file...I am stumped with this...
    The other dbms_output put_lines that display error displays okay, but not the one in the inner loop.... Can someone help me out if you see any obvious issues here........
    Also my UPDATE MEMBER statement inside the for loop doesn't do anything whereas it was supposed to update a row !!
    Thanks

    You could display the number the query return by adding;
    v_count number;After you assign v_personid;
    dbms_output.put_line('v_personid  is : '||v_personid );
    (select count(*)
    into v_count
    from person_relation
    where relpersonid in(
       select personid
       from person
       where PERSONID = v_personid)).
    dbms_output.put_line('v_count  is : '||v_count );

  • 30EA2 dbms_output.put_line not working

    Hi All,
    I've testing new release SQL Developer and
    the code bellow is not put any data to output? Is it an issue new version ?
    BEGIN
    dbms_output.put_line('[text]');
    END;
    SQL Developer
    Version 3.0.02
    Build MAIN-02.83
    Thank you in advance
    Edvard

    Hi Edvard,
    Yes, dbms_output is borked on 3.0EA2, but you can make it work if you put 'SET SERVEROUTPUT ON' in front of your statement:
    SET SERVEROUTPUT ON
    BEGIN
    dbms_output.put_line('[text]');
    END;
    And run it as a script (F5 on Windows, I think)
    See EA2: Dbms Output broken? for more.

Maybe you are looking for

  • Error while creating a temp queue (JMSException sayin .Destination dosnt ex

    i will just post part of my code Properties env = new Properties();                     env.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.NamingContextFactory");                     jndiContext = new InitialContext();                

  • Problem when I upload txt files to the server

    Hi, I have a problem when I try to upload files to the server, and I can't understand the fail. My case is: I have a jsp page where a from is. This form is sended to a servlet that proccess its content and upload the attach file to the server. It wor

  • Small doubts regarding devices and permissions

    Hill all, Continuing with my experiences with Oracle 11gR2 and Solaris 11, i came up with some "small" doubts regarding the permissions and owners of the devices to be used as ASM diskgroups. I was able to install Grid and the database, both 11.2.0.3

  • ISE Alarm Settings

    I'm looking for a way to control the alarm settings a little more granularly.  Currently when I modify the SMTP settings and alarm settings I end up getting every alarm sent to the email address I specify.  The problem is, I don't want ever single al

  • Flash 8 - Re-order an array, simple binding of xml

    I am prototyping a data table display. I need to show a data table inside a grid, using a simple xml file such as the one in the "DinnerMenu" tutorial whereby a button loads the xml file into the data grid component. I want to know how to set the ord