Is dbms_output.put() being buffered differently from dbms_output.put_line()?

后端 未结 1 1513
隐瞒了意图╮
隐瞒了意图╮ 2021-01-19 06:06

Im using Aqua Data Studio to debug a stored proc by scattering output statments throughout.

I have a delete statement in the package which violate an integrity const

相关标签:
1条回答
  • 2021-01-19 06:33

    Here is an example that shows the behaviour you're seeing:

    SQL> exec dbms_output.put_line('hello')
    hello
    
    PL/SQL procedure successfully completed.
    
    SQL> exec dbms_output.put('hello again')
    
    PL/SQL procedure successfully completed.
    
    SQL> exec dbms_output.put(' and again')
    
    PL/SQL procedure successfully completed.
    
    SQL> exec dbms_output.new_line
    hello again and again
    
    PL/SQL procedure successfully completed.
    

    The documentation says "SQL*Plus calls GET_LINES after issuing a SQL statement or anonymous PL/SQL calls."

    And procedure GET_LINES says "This procedure retrieves an array of lines from the buffer."

    With PUT you haven't completed your line yet. And so it doesn't print.

    The NEW_LINE procedure mentions this as well: "This procedure puts an end-of-line marker. The GET_LINE Procedure and the GET_LINES Procedure return "lines" as delimited by "newlines". Every call to the PUT_LINE Procedure or NEW_LINE Procedure generates a line that is returned by GET_LINE(S)."

    Regards,
    Rob.

    0 讨论(0)
提交回复
热议问题