Dbms_output problem

I am running oracle 8i on linux (mandrake 6) and have applied the
patch.
While playing around with some simple triggers etc I attempted to
use the dbms_output.put_line('stuff here') to keep track of, and
report on events as they happened.
The problem is that I do not get any output from these
statements.
for example I found this script elsewhere in the discussion group
(posted by someone using oracle on redhat 6):
declare
csr integer :=-1;
begin
csr:=dbms_sql.open_cursor;
if (csr = -1) then
dbms_output.put_line('Does not work!');
else
dbms_output.put_line('Works!');
end if;
end;
The output should be:
Works!
PL/SQL procedure successfully completed.
but on my system all I get is the second line, not the first.
Anyone have any ideas on why this would be so, and how to change
it.
Thanks
null

Execute 'set serveroutput on' before executing PL/SQL.
fintan (guest) wrote:
: I am running oracle 8i on linux (mandrake 6) and have applied
the
: patch.
: While playing around with some simple triggers etc I attempted
to
: use the dbms_output.put_line('stuff here') to keep track of,
and
: report on events as they happened.
: The problem is that I do not get any output from these
: statements.
: for example I found this script elsewhere in the discussion
group
: (posted by someone using oracle on redhat 6):
: declare
: csr integer :=-1;
: begin
: csr:=dbms_sql.open_cursor;
: if (csr = -1) then
: dbms_output.put_line('Does not work!');
: else
: dbms_output.put_line('Works!');
: end if;
: end;
: The output should be:
: Works!
: PL/SQL procedure successfully completed.
: but on my system all I get is the second line, not the first.
: Anyone have any ideas on why this would be so, and how to
change
: it.
: Thanks
null

Similar Messages

  • Base64 and dbms_output problem

    Hello,
    I'm trying to write a function that generate HTML content for sending inside a mail. This HTML content needs to have some picture inside it. To do so I'm using some conversion function from blob to base 64 encoding. To be sure that my function is working properly, I'm trying to execute it inside Oracle SQL developer.
    The problem is that whenever I'm tying to show up any base64 content via dbms_output.put_line I got:
    ORA-06502: PL/SQL: numeric or value error
    ORA-06512: at line xxx
    06502. 00000 - "PL/SQL: numeric or value error%s"
    Here is the part of the code where I'm trying to open file and convert it inside base64 content
    With those variable:
        -- locale variables
        vc_mail_content       CLOB;
        vc_file_folder        VARCHAR2(100);
        vb_lFile              BFILE;
        vc_image_content      CLOB;
        vb_image_content      BLOB;Code:
    FOR c_file_name IN
              ( SELECT filename, folder
                 FROM MO_ITEM_IMAGES
                 WHERE item_id = R_lots.item_id)
             LOOP
                dbms_output.put_line('attachement '||c_file_name.fileName);
                vb_image_content := NULL;
                DBMS_LOB.CREATETEMPORARY(vb_image_content,true);
                vb_lfile  := BFILENAME('MO_DIR', 'webdav/'||c_file_name.folder||'/'||c_file_name.fileName);
                DBMS_LOB.OPEN(vb_lfile, DBMS_LOB.LOB_READONLY);
                DBMS_LOB.OPEN(vb_image_content, DBMS_LOB.LOB_READWRITE);
                DBMS_LOB.LOADFROMFILE(     DEST_LOB => vb_image_content,
                            SRC_LOB  => vb_lfile,
                            AMOUNT   => DBMS_LOB.GETLENGTH(vb_lfile));
                DBMS_LOB.CLOSE(vb_lfile);
                vc_image_content := zzz_mails.getbase64String(vb_image_content);
                --/!\ This DBMS output creates the error /!\
                dbms_output.put_line(vc_image_content);
                DBMS_LOB.CLOSE(vb_image_content);
                vc_mail_content := vc_mail_content||vc_image_content;
             END LOOP; Whenever it reach the DBMS_output.put_line, I got the error.
    The getbase64String function is a function that translate from blob to base64 clob
    Can someone help me to solve this problem?
    Thank you
    Edited by: user13444434 on 3 juil. 2011 08:42

    DBMS_OUTPUT can not print CLOB in thay way. YOu can use a function like this:
    PROCEDURE print_clob(p_clob in clob) as
        l_offset number default 1;
      BEGIN
        loop
          exit when l_offset > dbms_lob.getlength(p_clob);
          dbms_output.put_line(dbms_lob.substr(p_clob, 255, l_offset));
          l_offset := l_offset + 255;
        end loop;
      END print_clob;and call that in your original procedure.

  • Sql developer - dbms_output problem

    Hi
    I am not getting any output using sql developer.
    set serveroutput on;
    begin
    dbms_ouput.enable(10000);
    dbms_output.put_line('abc');
    end;
    anonymous block completedI saw some threads ..with same problems. but I am not understanding where is that dbms_output tab in my sql developer ?
    Tried alot .. but no use.
    Please advise....!!!
    Regards
    Rekha

    In your SQL Developer (usually at the bottom) there should be a tab "Dbms Output".
    If there is not, then you probably have closed that tab at some point by accident - then you can get it back by going in the View menu and clicking Dbms Output.
    In that tab is a green plus sign - if you hover over it you will see the tool tip "Enable DBMS OUTPUT for connection".
    Clicking that green plus sign is similar to doing "set serveroutput on" in SQL*PLUS.
    When I try it, somehow it only seems to work if I run my script using F5 rather than F9?
    I think a good place to get further answers is in the SQL Developer forum - some of the people who write SQL Developer are helping out there ;-)

  • Newbie: DBMS_OUTPUT problem.

    Hi all,
    I have a very basic question...
    I wrote the code for the procedure as this
    SQL> create or replace procedure looptest as
      2   begin
      3    for idx in 3..1 loop
      4   dbms_output.put_line('a');
      5    dbms_output.put_line (idx);
      6   for idx1 in 1..3 loop
      7   dbms_output.put_line('b');
      8     dbms_output.put_line (idx1);
      9   end loop;
    10   end loop;
    11*   end;
    SQL> /
    Procedure created.
    SQL> exec looptest;
    PL/SQL procedure successfully completed.
    SQL> set serveroutput on;
    SQL> commit;
    Commit complete.
    SQL> exec looptest;
    PL/SQL procedure successfully completed.I wanted to see the result of running this procedure...
    a.k.a some output like 3, 1, 2, 3, 2, 1, 2,... etc
    question 1 : Why am i not able to see the result??
    question 2: What should be done to see the result
    Thanks in advance..

    DBMS_OUTPUT is a server-side API (PL/SQL package). It allows PL/SQL code to write into a session static/persistent buffer in PL/SQL.
    A client, like SQL*Plus, can then display the contents of this buffer after the PL/SQL code has completed execution.
    The SQL*Plus command to enable this client feature (of displaying the buffer) is SET SERVEROUTPUT ON.
    SQL> set serveroutput on
    SQL> begin
    2 for i in 1..10
    3 loop
    4 DBMS_OUTPUT.put_line( 'inside loop | counter='||i );
    5 end loop;
    6 end;
    7 /
    inside loop | counter=1
    inside loop | counter=2
    inside loop | counter=3
    inside loop | counter=4
    inside loop | counter=5
    inside loop | counter=6
    inside loop | counter=7
    inside loop | counter=8
    inside loop | counter=9
    inside loop | counter=10
    PL/SQL procedure successfully completed.
    SQL>

  • Sqldeveloper EA3 dbms_output problem

    Hello
    The code:
    begin
    dbms_output.put_line('ok');
    end;
    displays nothing in window created via menu view/dbms output
    I need to explicite run set serverouput on in worksheet using F5 or F9 to see results in "script output" window or "dbms output" window
    For "script output" it seems to be normal
    but for view/dbms output it was working different in previous releases set serverouput on was not required

    This is how I get dbms_output.put_line to work;
    -- test dbms_output.put_line
    -- output shows in script output region
    -- if dbms output view is on then clicking the green '+' and enabling the correct connection
    -- may show the ouput in the dbms output region also
    SET SERVEROUTPUT ON;
    DECLARE
    l_nbr NUMBER;
    BEGIN
    l_nbr := dbms_random.VALUE(1,999);
    dbms_output.put_line(to_char(l_nbr,'999'));
    END;
    I cant get the 'insert link' button to work but here is the URL for the original workaround;
    30EA2 dbms_output.put_line not working

  • Problem in Stored Procedure with DBMS_OUTPUT statement

    Hi All,
    I am facing a problem in the stored procedure.
    In the stored procedure I am picking records from the table and displaying them in the screen using dbms_output.put_line statement. This works fine if my query fetches few records but in case of many records(84000 records) then the oracle application gets hanged.

    1) How (if at all) does this relate to SQLJ/JDBC? I assume there is some relationship because of the forum you're posting to, so I'm trying to understand whether that relationship is germane to the problem you are having.
    2) Why are you writing 86,000 rows of output to the dbms_output buffer? Why wouldn't your stored procedure return a REF CURSOR to your Java application and just have the Java application iterate through those rows?
    Justin

  • Help me to make this workaround for dbms_output buffer(6502) problem click.

    Hi,
    what i am trying is to store multiline records into single variable. Say ename||'---'||empno||chr(10) ( chr(10) fro newline) from table emp into variable x. On outputting x o/p should be
    dbms_output.put_line(x)
    o/p to be :-
    scott---7306
    smith---7406
    continued like that.
    dbms_output.put_line( ) has buffer size of 255 so if more records x will not be displayed. value error will be there. for solution what i tried is to substring x again and again and display substring there and then.
    Here is my code :-
    declare
    x varchar2(4000);
    y varchar2(100);
    y1 varchar2(100);
    i number;
    j number :=1;
    k number;
    cursor c is select ename||'----'||empno||chr(10) from emp;
    begin
    open c;
    loop -- for all records to be in multiline manner in a single var
    fetch c into y ;
    exit when c%notfound;
    x:=x||y;
    end loop;
    close c;
    i:=instr(x,chr(10),1,1); -- initialise i with position of first appearance of chr(10)
    k:=2; -- i initialise it 2 so as to find second appearance of chr(10) in the loop
    loop -- this loop for outputting using substr
    y1:=substr(x,j,i); --- getting the first record say smith--7306 like that
    -- dbms_output.put_line(i);
    dbms_output.put_line(y1);
    j:=i+1; --- position from which next string to be extracted
    i:=instr(x,chr(10),1,k)-i; -- length of next appearance of chr(10)
    k:=k+1; -- incrementing for next chr(10)
    exit when(i<=0); -- instr returns 0 when chr(10) not found so exit
    end loop;
    end;
    desired output :-
    smith--7234
    scott--7321
    john--7431
    jack--7921
    output i am getting is like :-
    smith--7234
    scott--7321
    scott--7321
    john--7431
    john--7431
    jack--7921
    Not on expected lines. please help to correct this code.
    regards ravi.

    Is this not what you want?
    SQL>declare
      2     cursor c1 is select ename||'----'||empno details
      3                  from emp;
      4  begin
      5     for r1 in c1 loop
      6        dbms_output.put_line(r1.details);
      7     end loop;
      8  end;
      9  /
    KING      ----7839
    BLAKE     ----7698
    CLARK     ----7782
    JONES     ----7566
    MARTIN    ----7654
    ALLEN     ----7499
    TURNER    ----7844
    JAMES     ----7900
    WARD      ----7521
    FORD      ----7902
    SMITH     ----7369
    SCOTT     ----7788
    ADAMS     ----7876
    MILLER    ----7934
    KING      ----8888
    ADAMS     ----9999
    PL/SQL procedure successfully completed.
    SQL>Why do you need chr(10) again?
    Cheers
    Sarma.

  • Problem with DBMS_OUTPUT and SQL statment with a function

    I am using SQL Developer version 3.0.04 and I have a function that has a dbms_output statment in it. I am running the following SQL to select the output of that statment.
    select A.A_FUCTION('TEST') from dual;
    The output works fine but the dbms_output line does not show in the dbms_output window. I turned on the output window etc. and i can get the select to print out the output if i wrap it in a declare begin end wrapper... and then change the query to insert the return value into variable.
    just wondering if there is way to get the dbms_output to flush out with just an SQL statment instead of in a begin end wrapper etc.

    just wondering if there is way to get the dbms_output to flush out with just an SQL statment instead of in a begin end wrapper etc.works fine in sql*plus, so I guess it must be a preference or sth. in sql*developer:
    SQL> set serverout on
    SQL> create or replace function f1 (r int)
      2    return int
      3  as
      4  begin
      5    dbms_output.put_line ('Hello World ' || r);
      6    return r;
      7  end f1;
      8  /
    Function created.
    SQL>
    SQL> select f1 (rownum) f1 from dual connect by level <= 3
      2  /
            F1
             1
             2
             3
    3 rows selected.
    Hello World 1
    Hello World 2
    Hello World 3
    SQL>

  • Problem in dbms_output.put_line boolean variable

    hello guys m practicing PL/SQL when i try to exicute below code i get following error:
    DECLARE
    I BOOLEAN:=TRUE;
    BEGIN
    dbms_output.put_line(i);
    END;
    error:
    Error starting at line 1 in command:
    DECLARE
    I BOOLEAN:=TRUE;
    BEGIN
    dbms_output.put_line(i);
    END;
    Error report:
    ORA-06550: line 4, column 1:
    PLS-00306: wrong number or types of arguments in call to 'PUT_LINE'
    ORA-06550: line 4, column 1:
    PL/SQL: Statement ignored
    06550. 00000 - "line %s, column %s:\n%s"
    *Cause:    Usually a PL/SQL compilation error.
    *Action:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    user13355933 wrote:
    hello guys m practicing PL/SQL when i try to exicute below code i get following error:
    DECLARE
    I BOOLEAN:=TRUE;
    BEGIN
    dbms_output.put_line(i);
    END;
    error:
    Error starting at line 1 in command:
    DECLARE
    I BOOLEAN:=TRUE;
    BEGIN
    dbms_output.put_line(i);
    END;
    Error report:
    ORA-06550: line 4, column 1:
    PLS-00306: wrong number or types of arguments in call to 'PUT_LINE'
    ORA-06550: line 4, column 1:
    PL/SQL: Statement ignored
    06550. 00000 - "line %s, column %s:\n%s"
    *Cause:    Usually a PL/SQL compilation error.
    *Action:DBMS_OUTPUT.PUT_LINE only accepts strings (VARCHAR2) datatype
    what exactly do you expect to see, if in fact it worked as desired?

  • Dbms_output.put_line problem..

    We have created delete script to some 150 tables using cursors suppose we r deleting with some condition and use to display the output as
    dbms_output.put_line('Rows Deleted in the table distb_store_promo is '||SQL%ROWCOUNT);
    its shows error like it exceeds the limit.so we made setserver output off and running the query it works fine.is any other solution to overcome this..

    > is any other solution to overcome this..
    Yes. Do not use DBMS_OUTPUT. It is a very primitive API - useful for the odd debug display when debugging PL/SQL code. It should not be used for anything else. In fact, any DBMS_OUTPUT code in production PL/SQL requires serious reconsideration as those calls should be wrapped in a user PL/SQL proc.
    The proper and correct method would be to create a log PL/SQL procedure to log messages into an Oracle table, using autonomous transactions.

  • Problem in JAVA PL/SQL Block

    Hi all,
    I am facing a peculiar problem. I have one JAVA PL/SQL code, which runs a shell script, which indeed fire a zipping command remotely. Here I am providing you the code. Actually it zip some files at application server running from Database Server.
    create or replace procedure RC(p_cmd in varchar2)
    as
    x number;
    begin
    x := run_cmd(p_cmd);
    EXCEPTION
    when others then
    dbms_output.put_line('WHEN OTHERS '||sqlcode||sqlerrm);
    end;
    <====This RC is called from a before insert trigger. And value of p_cmd is $ORACLE_BASE/report_compress.sh $REPORT_DIR/<report_file>.
    create or replace
    function RUN_CMD(p_cmd in varchar2) return number
    as
    language java
    name 'Util.RunThis(java.lang.String) return integer';
    create or replace and compile
    java source named "Util"
    as
    import java.io.*;
    import java.lang.*;
    public class Util extends Object
    public static int RunThis(String args)
    Runtime rt = Runtime.getRuntime();
    int rc = -1;
    try
    Process p = rt.exec(args);
    int bufSize = 4096;
    BufferedInputStream bis =
    new BufferedInputStream(p.getInputStream(), bufSize);
    int len;
    byte buffer[] = new byte[bufSize];
    // Echo back what the program spit out
    while ((len = bis.read(buffer, 0, bufSize)) != -1)
    System.out.write(buffer, 0, len);
    rc = p.waitFor();
    catch (Exception e)
    e.printStackTrace();
    rc = -1;
    finally
    return rc;
    And also I have executed:
    BEGIN
    dbms_java.grant_permission('<DB_USER>','java.io.FilePermission','$ORACLE_BASE','write');
    dbms_java.grant_permission('<DB_USER>','java.io.FilePermission','$ORACLE_BASE/report_compress.sh','execute');
    dbms_java.grant_permission('<DB_USER>','java.lang.RuntimePermission','*', 'writeFileDescriptor' );
    END;
    REPORT_COMPRESS.SH
    #!/bin/sh
    remsh <APPLICATION SERVER IP> -l <APPLICATION_SERVER_OS_USER> -n "gzip -f $1"
    Now problem is while execute RC, it gives no error but the remote file does not get zipped. When I run report_compress.sh from command promt, it works fine.
    Earlier we used HP-UX as our DB server and Application Server. And RC worked fine there. Recently we have moved to AIX(for both DB and AS), and now we are facing this problem.
    Please guide me to resolve this problem.
    Note: .rhosts entry is fine in both the servers(as per me) as report_compress.sh is working fine.

    Make sure that the .profile does not read something from tty - it should not, but it sounds like the .profile is expecting tty input.
    Alternatively, simply copy and paste the environment settings from .profile to your compress script. The only read important setting is PATH as your script simply does a remote shell. Thus LD_LIBRARY_PATH/SHLIB_PATH and other settings are not needed.
    You can also add debugging to your shell script - useful when executing it in the background.
    Something as follows:
    # create debug file name
    DEBUGFILE=/tmp/~$$.debug-out # e.g. /tmp/~1234.debug-out where 1234 is the PID
    echo "`date` Starting [$0] with parameters [$*]" >> $DEBUGFILE
    # sourcing environment
    echo "Loading default profile..." >>$DEBUGFILE
    . /home/oracle/.profile 1>>$DEBUGFILE 2>>$DEBUGFILE
    # running remote shell
    echo "Running remote shell..." >>$DEBUGFILE
    remsh ... 1>>$DEBUGFILE 2>>$DEBUGFILE
    .. etc.
    When this is working, you can remove the debug file from the shell script, or simply delete it when the script is successful.

  • PL/SQL Performance problem

    I am facing a performance problem with my current application (PL/SQL packaged procedure)
    My application takes data from 4 temporary tables, does a lot of validation and
    puts them into permanent tables.(updates if present else inserts)
    One of the temporary tables is parent table and can have 0 or more rows in
    the other tables.
    I have analyzed all my tables and indexes and checked all my SQLs
    They all seem to be using the indexes correctly.
    There are 1.6 million records combined in all 4 tables.
    I am using Oracle 8i.
    How do I determine what is causing the problem and which part is taking time.
    Please help.
    The skeleton of the code which we have written looks like this
    MAIN LOOP ( 255308 records)-- Parent temporary table
    -----lots of validation-----
    update permanent_table1
    if sql%rowcount = 0 then
    insert into permanent_table1
    Loop2 (0-5 records)-- child temporary table1
    -----lots of validation-----
    update permanent_table2
    if sql%rowcount = 0 then
    insert into permanent_table2
    end loop2
    Loop3 (0-5 records)-- child temporary table2
    -----lots of validation-----
    update permanent_table3
    if sql%rowcount = 0 then
    insert into permanent_table3
    end loop3
    Loop4 (0-5 records)-- child temporary table3
    -----lots of validation-----
    update permanent_table4
    if sql%rowcount = 0 then
    insert into permanent_table4
    end loop4
    -- COMMIT after every 3000 records
    END MAIN LOOP
    Thanks
    Ashwin N.

    Do this intead of ditching the PL/SQL.
    DECLARE
    TYPE NumTab IS TABLE OF NUMBER(4) INDEX BY BINARY_INTEGER;
    TYPE NameTab IS TABLE OF CHAR(15) INDEX BY BINARY_INTEGER;
    pnums NumTab;
    pnames NameTab;
    t1 NUMBER(5);
    t2 NUMBER(5);
    t3 NUMBER(5);
    BEGIN
    FOR j IN 1..5000 LOOP -- load index-by tables
    pnums(j) := j;
    pnames(j) := 'Part No. ' || TO_CHAR(j);
    END LOOP;
    t1 := dbms_utility.get_time;
    FOR i IN 1..5000 LOOP -- use FOR loop
    INSERT INTO parts VALUES (pnums(i), pnames(i));
    END LOOP;
    t2 := dbms_utility.get_time;
    FORALL i IN 1..5000 -- use FORALL statement
    INSERT INTO parts VALUES (pnums(i), pnames(i));
    get_time(t3);
    dbms_output.put_line('Execution Time (secs)');
    dbms_output.put_line('---------------------');
    dbms_output.put_line('FOR loop: ' || TO_CHAR(t2 - t1));
    dbms_output.put_line('FORALL: ' || TO_CHAR(t3 - t2));
    END;
    Try this link, http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96624/05_colls.htm#23723

  • Script for generating XML file ... problem with null values

    Greetings everyone,
    i come here with a question that troubles me for some time now. I have a script which i run from SQLPLUS every now and then to generate an XML file.
    Problem is that data which needs to be in XML is not allways <> NULL and i need to hide those tags that are empty </tag>.
    I will post below my script and if you could help me with it it would be really great!
    Thanks for reading!
    set long 20000000
    set long 20000000
    set linesize 32000
    SET ECHO OFF
    SET TRIMSPOOL on
    SET HEADING OFF
    SET PAGESIZE 50000
    SET VERIFY OFF
    SET FEEDBACK OFF
    SET TERMOUT OFF
    spool C:\test.xml
    set serveroutput on
    begin
      dbms_output.put_line('<?xml version="1.0" encoding="utf-8" ?>');
    end;
    SELECT
    XMLELEMENT("ReportRoot",XMLATTRIBUTES('http://www.w3.org/2001/XMLSchema-instance' as "xmlns:xsi", 'http://www.w3.org/2001/XMLSchema' as "xmlns:xsd" , '1.0' as "Version",sysdate as "CreationDate",to_char(sysdate,'hh:mm:ss') as "CreationTime",'1524544845' as "id"),
    XMLELEMENT("Porocila",XMLELEMENT("JOLY",(SELECT XMLAGG (XMLELEMENT("RefNrReport",replace('SON'||to_char(ref_ST,'00000'),' ',''))) from access_table_2 where ref_ST = &1),
    XMLELEMENT("ReportDate",sysdate),XMLELEMENT("Labeling",'545254450'),
    (SELECT XMLAGG     (XMLELEMENT("Reportf",
                                                                     XMLELEMENT("access",access),
                                                                     XMLELEMENT("date",date),
                                                                     XMLELEMENT("datep",datep),
                                                                     XMLELEMENT("ModificationInfo",'M'),XMLELEMENT("ModificationReason",modireason)))
                                                 from v_xml_test where id_dok = &1 and ind_print = '1'))))
      .extract('/*')
      from dual
         spool off
    exitNow lets pretend that XMLELEMENT("datep",datep), is sometimes NULL and i do not want to display it.

    may be
    with t as
    select sysdate datep from dual union all
    select null datep from dual
    select xmlagg(xmlelement("Reportf",
                             case when datep is not null then XMLELEMENT("datep", datep)
                             end
      from t

  • Dynamic SQL and Bulk Bind... Interesting Problem !!!

    Hi Forum !!
    I've got a very interesting problem involving Dynamic SQL and Bulk Bind. I really Hope you guys have some suggestions for me...
    Table A contains a column named TX_FORMULA. There are many strings holding expressions like '.3 * 2 + 1.5' or '(3.4 + 2) / .3', all well formed numeric formulas. I want to calculate each formula, finding the number obtained as a result of each calculation.
    I wrote something like this:
    DECLARE
    TYPE T_FormulasNum IS TABLE OF A.TX_FORMULA%TYPE
    INDEX BY BINARY_INTEGER;
    TYPE T_MontoIndicador IS TABLE OF A.MT_NUMBER%TYPE
    INDEX BY BINARY_INTEGER;
    V_FormulasNum T_FormulasNum;
    V_MontoIndicador T_MontoIndicador;
    BEGIN
    SELECT DISTINCT CD_INDICADOR,
    TX_FORMULA_NUMERICA
    BULK COLLECT INTO V_CodIndicador, V_FormulasNum
    FROM A;
    FORALL i IN V_FormulasNum.FIRST..V_FormulasNum.LAST
    EXECUTE IMMEDIATE
    'BEGIN
    :1 := TO_NUMBER(:2);
    END;'
    USING V_FormulasNum(i) RETURNING INTO V_MontoIndicador;
    END;
    But I'm getting the following messages:
    ORA-06550: line 22, column 43:
    PLS-00597: expression 'V_MONTOINDICADOR' in the INTO list is of wrong type
    ORA-06550: line 18, column 5:
    PL/SQL: Statement ignored
    ORA-06550: line 18, column 5:
    PLS-00435: DML statement without BULK In-BIND cannot be used inside FORALL
    Any Idea to solve this problem ?
    Thanks in Advance !!

    Hallo,
    many many errors...
    1. You can use FORALL only in DML operators, in your case you must use simple FOR LOOP.
    2. You can use bind variables only in DML- Statements. In other statements you have to use literals (hard parsing).
    3. RETURNING INTO - Clause in appropriate , use instead of OUT variable.
    4. Remark: FOR I IN FIRST..LAST is not fully correct: if you haven't results, you get EXCEPTION NO_DATA_FOUND. Use Instead of 1..tab.count
    This code works.
    DECLARE
    TYPE T_FormulasNum IS TABLE OF VARCHAR2(255)
    INDEX BY BINARY_INTEGER;
    TYPE T_MontoIndicador IS TABLE OF NUMBER
    INDEX BY BINARY_INTEGER;
    V_FormulasNum T_FormulasNum;
    V_MontoIndicador T_MontoIndicador;
    BEGIN
    SELECT DISTINCT CD_INDICATOR,
    TX_FORMULA_NUMERICA
    BULK COLLECT INTO V_MontoIndicador, V_FormulasNum
    FROM A;
    FOR i IN 1..V_FormulasNum.count
    LOOP
    EXECUTE IMMEDIATE
    'BEGIN
    :v_motto := TO_NUMBER('||v_formulasnum(i)||');
    END;'
    USING OUT V_MontoIndicador(i);
    dbms_output.put_line(v_montoindicador(i));
    END LOOP;
    END;You have to read more about bulk- binding and dynamic sql.
    HTH
    Regards
    Dmytro
    Test table
    a
    (cd_indicator number,
    tx_formula_numerica VARCHAR2(255))
    CD_INDICATOR TX_FORMULA_NUMERICA
    2 (5+5)*2
    1 2*3*4
    Message was edited by:
    Dmytro Dekhtyaryuk

  • LDAP Active Directory Problem

    Hi,
    i have a win 2003 server (german) and apex 3.x. I (hope i ) have read all postings to this topic. Read the Apex Book, tried the Oracle Examples but all examples i have found won´t work for me. After three hours i found one solution that works:
    (Domain: marco.de)
    create or replace FUNCTION check_ldap_user(
    p_username IN VARCHAR2,
    p_password IN VARCHAR2
    ) RETURN boolean IS
    l_session DBMS_LDAP.session;
    l_ret binary_integer;
    BEGIN
    l_session := DBMS_LDAP.init (
    hostname => '192.168.178.100',
    portnum => '389');
    IF (DBMS_LDAP.simple_bind_s (
    ld => l_session,
    --dn => 'cn='||upper(p_username)||',cn=user,dc=marco,dc=de', /* <= This line does not work */
    dn => upper(p_username), /* <= This Version work */
    passwd => p_password)) = 0 AND p_password IS NOT NULL THEN
    l_ret:=DBMS_LDAP.UNBIND_S(ld=> l_session);
    RETURN True;
    ELSE
    RETURN False;
    END IF;
    EXCEPTION WHEN OTHERS THEN
    dbms_output.put_line(sqlerrm);
    RETURN FALSE;
    END;
    The Question is, if there any problems with a german Active Directory Server (Mayby the groups like "Domänen-Admins" are the problem)
    Thanks
    Marco

    Hi,
    Any help?

Maybe you are looking for