ORA-06503: PL/SQL: function returned no value

Hi guys,.
I wrote a function that returns the number of quarter for a given date.
Here's the function

FUNCTION to CREATE or REPLACE fn_get_quarter
(p_date DATE)
RETURN NUMBER
AS
v_qtr NUMBER;
BEGIN
Select TO_CHAR (p_date, 'Q')
IN v_qtr
DOUBLE;
dbms_output.put_line (' it's quarter ' | v_qtr);
END;

It compiled without error.

Here is the test case that I wrote

DECLARE
p_date DATE: = TO_DATE('12/22/2009','MM/DD/YYYY');
v_qtr NUMBER;
BEGIN
v_qtr: = fn_get_quarter (p_date);
END;

When I run the present, I get the following error.

ORA-06503: PL/SQL: function returned no value
ORA-06512: at "GPS_FVO. FN_GET_QUARTER', line 13
ORA-06512: at line 7

But surprisingly, I get the result.

Please suggest and let me know how to get rid of this error and why I get this error.

Thanks in advance.
Sam

RETURN v_qtr;
should be added after DBMS_OUTPUT

Tags: Database

Similar Questions

  • ORA-06503: PL/SQL: function returned no value ORA-06512:

    Hi all

    SQL > set serveroutput on

    SQL > CREATE OR replace FUNCTION qty_value (p_item_id number)

    2 RETURN NUMBER

    3 EAST

    4 v_qty_arrival NUMBER;

    5 BEGIN

    6. SELECT THE CASE SENSITIVE OPTION

    7. WHAT (SUM (b.quantity) - SUM (b.quantity_received)) < = 0 THEN 0

    8 ELSE (SUM (b.quantity) - SUM (b.quantity_received))

    9 END Qty_Arrival

    10 INTO v_qty_arrival

    Po_lines_all 11 a,

    po_line_locations_all 12 b

    13 WHERE a.po_line_id = b.po_line_id

    14 AND a.item_id = p_item_id;

    15 EXCEPTION

    16 THEN THAN OTHERS THEN

    17 v_qty_arrival: = NULL;

    18 RETURN v_qty_arrival;

    19 END qty_value;

    20.

    The function is created.

    SQL >

    SQL > select xxc_qty_arrivale (214960) double

    2.

    Select xxc_qty_arrivale (214960) double

    *

    ERROR on line 1:

    ORA-06503: PL/SQL: function returned no value

    ORA-06512: at the 'APPS '. XXC_QTY_ARRIVALE', line 19

    Back AFTER using the exception block is fine as long as your code actually REACHED the exception block.

    When there are no errors, then your code will not enter the exception block, but you still NEED to return a value, since it is what functions a function wants to return a value, that's what the functions are made for.

    Spot the differences between the following 3 functions. Understand how they work.

    The first function has only a return in the exception block but runs correctly. Result: error, because the back is missing in the code block.

    The second function has a return in the exception block and one in the block of code and runs correctly. Result: no error, because the return is not missing in the code block.

    The third function has a return in the exception block and one in the block of code and is forced into an error. Result: no error, because the return of the exception handler is used (instead of retriggering of the error, which you would normally do).

    SQL > create or replace function myfunc

    2 return number

    3 as

    4 start

    5 dbms_output.put_line ('in the section of code');

    6 null;

    7 exception

    8 then than others

    9. can

    10 dbms_output.put_line (' in the exception handler ' |) SQLERRM);

    11      --

    12 return 0;

    13      --

    14 end;

    15.

    The function is created.

    SQL > select double myfunc;

    Select double myfunc

    *

    ERROR on line 1:

    ORA-06503: PL/SQL: function returned no value

    ORA-06512: at "GHPLUS. MYFUNC", line 14

    In the section of code

    SQL > create or replace function myfunc

    2 return number

    3 as

    4 start

    5 dbms_output.put_line ('in the section of code');

    6 null;

    7    --

    8 return 1;

    9    --

    10 exceptional

    11 so that others

    12. can

    13 dbms_output.put_line (' in the exception handler ' |) SQLERRM);

    14      --

    15 return 0;

    16      --

    end 17;

    18.

    The function is created.

    SQL > select double myfunc;

    MYFUNC

    ----------

    1

    1 selected line.

    In the section of code

    SQL > create or replace function myfunc

    2 return number

    3 as

    n number 4;

    5. start

    6 dbms_output.put_line ('in the section of code');

    7 n: = 1/0; -force an error (zero divisor) to join the exception handler

    8    --

    9 return 1;

    10-

    exception 11

    12 so that others

    13. can

    14 dbms_output.put_line (' in the exception handler ' |) SQLERRM);

    15      --

    16 return 0;

    17      --

    18 end;

    19.

    The function is created.

    SQL > select double myfunc;

    MYFUNC

    ----------

    0

    1 selected line.

    In the section of code

    In the handler for exception ORA-01476: divisor is equal to zero

    SQL >

  • While the BLOB conversion of type CLOB error - ORA-06502: PL/SQL: digital error or value

    Passing data from attachment of DB (Blob data Type) after the CLOB data type conversion, giving the error "ORA-06502: PL/SQL: digital error or value" in the PL/SQL package. If the BLOB size 32K > it will give another error works great my procedure.

    For example, I enclose my code here.

    function get_base64 (p_blob_in in blob) return clob is

    CLOB v_clob;

    CLOB v_result;

    whole v_offset;

    v_chunk_size PLS_INTEGER: = 12288;

    v_buffer_varchar varchar2 (32767).

    v_buffer_raw raw (32767).

    Start

    fnd_file.put_line (fnd_file.log, 'here');

    If p_blob_in is null then

    Returns a null value.

    end if;

    DBMS_LOB.CREATETEMPORARY (v_clob, true);

    fnd_file.put_line (fnd_file.log, 'here1');

    v_offset: = 1;

    fnd_file.put_line (fnd_file.log, 'Loop value'-| ceil (DBMS_LOB.) GetLength (p_blob_in) / v_chunk_size));

    because me in 1... ceil (DBMS_LOB. GetLength (p_blob_in) / v_chunk_size) loop

    DBMS_LOB. Read (p_blob_in, v_chunk_size, v_offset, v_buffer_raw);

    v_buffer_raw: = utl_encode.base64_encode (v_buffer_raw);

    v_buffer_varchar: = utl_raw.cast_to_varchar2 (v_buffer_raw);

    DBMS_LOB. WriteAppend (v_clob, length (v_buffer_varchar), v_buffer_varchar);

    v_offset: = v_offset + v_chunk_size;

    end loop;

    fnd_file.put_line (fnd_file.log, 'Out of the loop');

    v_result: = v_clob;

    fnd_file.put_line (fnd_file.log, 'V_result length' - |) DBMS_LOB. GetLength (v_result));

    fnd_file.put_line (fnd_file.log, 'V_result' - | v_result);

    DBMS_LOB.freeTemporary (v_clob);

    Return v_result;

    exception

    while others then

    fnd_file.put_line (fnd_file.log, 'Error based on the encode_base64' - |) SQLERRM);

    Returns a null value.

    end;

    In my main program I call this function as below:

    Main proceedings...

    l_return_clob CLOB.

    Begin

    ....

    l_return_clob: = get_base64 (p_blob_in);

    -In returning it gives error - ORA-06502: PL/SQL: digital error or value

    end;

    Then, please mark the thread ANSWERED.

  • Getting Ora-06502: PL/SQL of Numeric or value error.

    Hello

    I m getting the following error when a calculation for form fields.

    ""Server Ajax Call returned error Ora-06502: PL/SQL digital error or value ".

    I m using the dynamic action to calculate my value fields display. Here is the code of my DA.

    (Required value) event: change

    Selection type (required): product (s)

    Article (s) (required): P141_PROP_COST, P141_DOWNPAY_AMT, P141_PREM_PERC, P141_DOWNPAY_PERC, P141_PREM_AMT



    Begin

    : P141_TOTAL_SELL_PRICE: =: P141_DOWNPAY_AMT +: P141_PREM_AMT;

    : P141_COMM_AMT: =: P141_TOTAL_SELL_PRICE*.02;

    : P141_TOTAL_SELL_PRICE_FEE: =: P141_TOTAL_SELL_PRICE +: P141_TRANSFER_COST +: P141_COMM_AMt;

    : P141_INST_REM_AMT: =: P141_PROP_COST-: P141_DOWNPAY_AMT;

    End;

    Page point to presented: P141_PROP_COST, P141_DOWNPAY_AMT, P141_PREM_AMT, P141_TRANSFER_COST

    Return point page: P141_TOTAL_SELL_PRICE, P141_COMM_AMT, P141_TOTAL_SELL_PRICE_FEE, P141_INST_REM_AMT

    I m using another DA for the calculation and validation of my form fields rest. Here is the code:

    {$("#P141_DOWNPAY_PERC").change (function ()}

    var x = ($("#P141_DOWNPAY_PERC").val () / 100) * $("#P141_PROP_COST").val ();

    $("#P141_DOWNPAY_AMT").val (x);

    });

    {$("#P141_DOWNPAY_AMT").change (function ()}

    If ($("#P141_DOWNPAY_AMT").val () > $("#P141_PROP_COST").val ())

    {

    Alert ("section may be no greater than the basic price");

    }

    on the other

    {var y = ($("#P141_DOWNPAY_AMT").val () / ($("#P141_PROP_COST").val ())) * 100;}

    y = Math.Round (y);

    $("#P141_DOWNPAY_PERC").val (y) ;}

    });

    {$("#P141_PREM_PERC").change (function ()}

    var x = ($("#P141_PREM_PERC").val () / 100) * $("#P141_PROP_COST").val ();

    $("#P141_PREM_AMT").val (x);

    });

    {$("#P141_PREM_AMT").change (function ()}

    If ($("#P141_PREM_AMT").val () > $("#P141_PROP_COST").val ())

    {

    Alert ("section may be no greater than the basic price");

    }

    on the other

    {var z = ($("#P141_PREM_AMT").val () / ($("#P141_PROP_COST").val ())) * 100;}

    z = Math.Round (z);

    $("#P141_PREM_PERC").val (z) ;}

    });

    Any help.

    Concerning

    Pa

    'Problems of implicit conversion' comes to mind when I see this:

    : P141_TOTAL_SELL_PRICE: =: P141_DOWNPAY_AMT +: P141_PREM_AMT;

    This is similar to the problems I've seen when using the default formats for the Date Picker Item Types.

    I will add in some APEX_DEBUG. MESSAGE() lines to check what are the string values.

    (remember, all bind variables are of type VARCHAR2)

    You should maybe explicitly to convert strings to numbers using TO_NUMBER() and include the appropriate format.

    (a bit like you have to do with the conversion of strings to dates.)

    My $0.02 worth

    MK

  • ORA-06502: PL/SQL: digital error or value

    Hello

    We have a package with a cursor that returns the session information:

    create or replace 
    PACKAGE BODY             "LOGIN_AUDIT" 
    ...
    ...
      CURSOR session_cur IS
        SELECT * FROM v$session WHERE audsid=USERENV('sessionid');
    
     session_rec session_cur%ROWTYPE;
    
    ...
    
    FUNCTION get_osuser
        RETURN VARCHAR2
      IS
      BEGIN
        RETURN session_rec.osuser;
      END;
    
    FUNCTION get_dbuser
        RETURN VARCHAR2
      IS
      BEGIN
        RETURN NVL(session_rec.username, 'ORACLE_SYS');
      END;
    
    ...
    

    The package compiled successfully and works ok out for a function that is the get_osuser. When you launch sqlplus, we get the following error:

    Select double LOGIN_audit.get_osuser;

    *

    ERROR on line 1:

    ORA-06502: PL/SQL: digital error or value

    ORA-06512: at "APPUSR. LOGIN_AUDIT', line 94

    ORA-06512: at "APPUSR. LOGIN_AUDIT', line 102

    The APPUSR has select priv on V$ SESSION and a select * from v$ session returns the session information. We can perform any other function since the package without any problem, for example:

    APPUSR@APPD > select double login_audit.get_dbuser;

    GET_DBUSER

    -------------------------------------------------------------

    APPUSR

    Can someone help us work on what happens please.

    PS Oracle: 11.2.0.3, OS Windows 2008 server.

    Thank you

    Really I have not aside, this and raise the question?

    Why you write all this code?

    wouldn't the following very good enough?

    1. FUNCTION get_osuser RETURN VARCHAR2;                    Use sys_context ('USERENV', 'OS_USER')
    2. FUNCTION get_dbuser RETURN VARCHAR2;                    Use sys_context ('USERENV', 'SESSION_USER')
    3. FUNCTION get_client_info RETURN VARCHAR2;                   Use sys_context ('USERENV', 'CLIENT_INFO')
    4. FUNCTION get_module_info RETURN VARCHAR2;               Use sys_context ('USERENV', 'MODULE')
    5. FUNCTION get_action_info RETURN VARCHAR2;                  Use sys_context ('USERENV', 'ACTION')

    Just do not know, I see the advantage of messing around with this slider and have to fight with the updating of information and others.

    This would totally work around the error you get and probably accelerate - and make it easier to maintain.

    ??

    Unless there is some additional requirements, that I'm missing

  • ORA-06502: PL/SQL: digital error or value: number too high accuracy

    Hi all
    Sorry I can't speak English very well
    ========
    IM creating a function in the hr schema
    I need to calculate a tax
    syntax of the function is

    CREATE OR REPLACE THE TAX FUNCTION
    (F_TAX EMPLOYEES % OF SALARY TYPE)
    RETURN NUMBER IS
    V_SAL EMPLOYEES. % SALARY TYPE.

    BEGIN
    SELECT salary * 12
    IN v_sal
    Employees
    WHERE EMPLOYEE_ID = F_TAX;
    IF V_SAL > = 40000 THEN
    V_SAL: = V_SAL / 0,20;
    ELSIF V_SAL > = 30000 THEN
    V_SAL: = V_SAL / 0.15;
    END IF;
    RETURN V_SAL;
    TAX END;
    ==================
    When I select a tax I have this problem
    SELECT (EMPLOYEE_ID) TAX
    EMPLOYEES

    It comes
    SELECT (EMPLOYEE_ID) TAX
    *
    ERROR on line 1:
    ORA-06502: PL/SQL: digital error or value: number too high accuracy
    ORA-06512: at "HR. The TAX", line 16

    V_SAL is declared as HR. EMPLOYEES. % OF SALARY TYPE. If you look at the definition of time. The table EMPLOYEES, the SALARY column is a NUMBER (8,2). This means that it can handle numbers up to $999,999.99 (8 total digits with 2 decimal places).

    Your IF statement is dividing the salary by 0.20, which is equivalent to multiplying by 5 or dividing by 0.15, which is multiplied by 6.67. In reality, at least a salary is high enough now that when you multiply by 5 or 6.67 it exceeds the limit of $999,999.99 (especially when you already multiplied by 12 SALARY column in your SELECT statement).

    -If your intention is to return in numbers that exceed the limits of the SALARY column in human resources. EMPLOYEES, you will need to declare V_SAL differently. You can declare V_SAL as a NUMBER (11.2), for example, given that any number that you store in a NUMBER (8.2), multiplied by 60, which can be represented in a NUMBER (11.2).
    -If your intention is to return the numbers that fall within the limits of the SALARY column in human resources. USED, I suspect that the algorithm that you implemented is incorrect. Perhaps, for example, you would divide by 1.2 or 1.15 as a kind of tax accounting?

    Justin

  • ORA-06502: PL/SQL: digital error or value: hex to raw conversion error

    Hello gurus,

    I'm trying to encrypt the dbms_obfuscation_toolkit method

    CREATE or REPLACE function Cryption2 (long input_string) gross yield
    IS
    -input_string VARCHAR2 (16): = "tigertigertigert";
    raw message (32767).
    raw_input RAW (128);
    long key_string (20000): = "scottsco";
    raw_key RAW (128);
    encrypted_raw RAW (2048);
    long encrypted_string (20000);
    decrypted_raw RAW (2048);
    long decrypted_string (20000);
    error_in_input_buffer_length EXCEPTION;
    PRAGMA EXCEPTION_INIT(error_in_input_buffer_length,-28232);
    INPUT_BUFFER_LENGTH_ERR_MSG VARCHAR2 (100): =.
    ' * NOT A MULTIPLE OF 8 BYTES IN THE INPUT BUFFER AND *';
    BEGIN
    message: = UTL_RAW. CAST_TO_RAW (Convert (input_string, 'AL32UTF8', 'US7ASCII'));
    message: = UTL_RAW. CAST_TO_RAW (Convert (key_string, 'AL32UTF8', 'US7ASCII'));
    dbms_output.put_line (' > = BEGIN TEST =');
    dbms_output.put_line (' > enter string: ' |)
    input_string);
    START < ignore this, typo in the Oracle documentation
    dbms_obfuscation_toolkit. Decrypt)
    input_string = > input_string,.
    key_string = > key_string,
    encrypted_string = > encrypted_string);
    dbms_output.put_line (' > Encrypted string: ' |)
    encrypted_string);
    -Add as shown DESDecrypt, gross change in chaine_cle
    -END IF;
    Return encrypted_string;
    EXCEPTION
    WHEN error_in_input_buffer_length THEN
    dbms_output.put_line (' > ' |) INPUT_BUFFER_LENGTH_ERR_MSG);
    END;
    /

    But I get the following error

    When I try:-select cryption2 ('abcdefgh') of double;

    ORA-06502: PL/SQL: digital error or value: hex to raw conversion error
    ORA-06512: at the "', line 31" "

    Thanks and greetings
    Pratik Lacoste
    DBA Oracle Jr

    Published by: Pratik.L on December 13, 2009 21:58

    Hey Pratik,

    You seem to be under pressure. The code that you pasted last a lot of stupid mistakes.
    In both the features that you use to encrypt or decrypt that you must follow the data type, the procedure is overloaded.

    Source: http://download.oracle.com/docs/cd/B13789_01/appdev.101/b10802/d_obtool.htm

    The previous post for this was varchar2 usinf encrpt and decrypt.

    The code below, which is your code, I'm taking the value as varchar2 and return varchar2 but internally
    that you posted, I'm going in raw data to her encrypt and decrypt procedures.

    SQL> CREATE OR REPLACE Function try_Cryptit (input long) return clob
      2   IS
      3
      4  key_string RAW(2000);
      5  crypt_dycp_raw RAW(2000);
      6  crypt_encp_raw RAW(2000);
      7  crypt_str clob;
      8  key_raw RAW(2000) := UTL_RAW.CAST_TO_RAW('frankzap');
      9  input_raw RAW(2000):=UTL_RAW.CAST_TO_RAW(input);
     10   message varchar2(2000);
     11
     12  BEGIN
     13   dbms_obfuscation_toolkit.DESEncrypt(
     14   input => input_raw,
     15   KEY => key_raw,
     16   encrypted_data => crypt_encp_raw);
     17
     18   -- Decrypt the string --
     19
     20   dbms_obfuscation_toolkit.DESDecrypt(
     21   input => crypt_encp_raw,
     22   KEY => key_raw,
     23   decrypted_data => crypt_dycp_raw);
     24
     25   crypt_str := utl_raw.cast_to_varchar2(input_raw);
     26   return crypt_str;
     27   END;
     28
     29  /
    
    Function created.
    
    SQL> select try_Cryptit ('abcdefgh') from dual;
    
    TRY_CRYPTIT('ABCDEFGH')
    --------------------------------------------------------------------------
    abcdefgh
    

    Follow be varchar2 or raw for this purpose.

    Twinkle

  • Process apex Pl/SQL error: ORA-06502: PL/SQL: digital error or value: specified incorrect LOB Locator

    Apex 4.2

    I searched through the forums of the research about this error, but I do not understand what to do from here. I am writing a process that sends an e-mail when a value of the claim is made (or on a button click). Procedure is as follows:

    DECLARE
       l_body        clob;
       l_body_html   clob;
       l_subject    varchar2(100);
    
    BEGIN
      
    l_body := empty_clob();
    l_body_html := empty_clob();
    
    
    IF V('REQUEST') in ('SAVE_ME') AND :P32_PARENT_UPDATED_FL IS NOT NULL THEN
       l_subject :=  'Survey Job Request Updated'||utl_tcp.crlf||utl_tcp.crlf;
       l_body := 'Update'||utl_tcp.crlf;
    
       l_body_html := '<html>
          <head>
             <style type = "text/css">
                 /* Can add style attributes later */
             </style>
          </head>
          <body>'||utl_tcp.crlf;
       l_body_html := l_body_html ||'Survey Job Request has been updated.<br /><br />'||utl_tcp.crlf;
       l_body_html := l_body_html ||'Title: '||utl_tcp.crlf;
       l_body_html := l_body_html ||:P32_TITLE||utl_tcp.crlf;
       l_body_html := l_body_html ||'<br />Request Category : '||utl_tcp.crlf;
       l_body_html := l_body_html ||:P32_REQUEST_CATEGORY||utl_tcp.crlf;
       l_body_html := l_body_html ||'<br />Update Date: '||utl_tcp.crlf;
       l_body_html := l_body_html ||:P32_UPDATE_DATE||utl_tcp.crlf;
       l_body_html := l_body_html ||'<br />Updated By: '||utl_tcp.crlf;
       l_body_html := l_body_html ||:P32_LAST_EDITED_BY_USERID||utl_tcp.crlf;
       l_body_html := l_body_html ||'</body></html>';
    
    
    
    
    
    END IF;
    
    :P32_CANCELLATION_REASON := l_body_html;
    
    apex_mail.send(
       p_to             =>  '[email protected]',
       p_from           =>  '[email protected]',
       p_body           =>  l_body_html,
       p_body_html      =>  l_body_html,
       p_subj           =>  l_subject);
    
    END;
    
    
    
    
    
    
    
    
    
    

    I added two lines to the code (lines 08 and 09) and when I run my program, I now get the error:

    • ORA-21560: 3 argument is null, invalid or out of range

    Without these two lines, I received the error:

    ORA-06502: PL/SQL: digital error or value: specified incorrect LOB Locator

    I'm not quite sure what is wrong or what I can change. There seems to be right, and in fact, it worked before. I have no idea why this error keeps popping up. Any help on that would be great. Thanks in advance.

    Hello

    NewApexCoder wrote:

    Hmmm... good point. I think that apex_mail.send must be called inside the IF block. But in the future, I added several conditional statements, won't I need to include the apex_mail.send function in each IF block? But at the same time, there is the case that if no conditional instructions are met? Tests, when none of the conditions are true (when I had a second IF block in the code), an email would not be defined, which is correct. Could that be causing a problem however. If the IF block is not filled could he always try to send an email about anything or the l_body_html and l_subject fields have in them the garbage that causing ORA error?

    If the call to the procedure of sending (it is a procedure, and not a function) many times is necessary or useful depends on exactly what you're trying to do.

    For example, you can write to Santa for

    • Submit a wish list
    • Change of address
    • Contradiction with your boss, who can you tell Santa you were mean

    or any combination of these grounds.  If you want to send a simple email whenever any of the conditions are met (and not send a when none are met), then you could do something like this:

    DECLARE

    need_to_send BOOLEAN: = FALSE;

    ...

    BEGIN

    ...

    IF wish_list IS NOT NULL

    THEN

    l_body: = l_body | ...

    need_to_send: = TRUE;

    END IF;

    IF old_addresss <> new_address

    THEN

    l_body: = l_body | ...

    need_to_send: = TRUE;

    END IF;

    IF boss_is_a_big_fat_liar

    THEN

    l_body: = l_body | ...

    need_to_send: = TRUE;

    END IF;

    IF need_to_send

    SO - It's the only call to send

    apex_mail. Send...

    In any case, the error message ' ORA-21560: argument 3 sucks...» "is pretty clear: If you have not given a value to everything you're passing as p_body, then you'd better call the procedure.

  • UTL_SMTP. Data ORA-06502: PL/SQL: digital error or value

    Hello

    I use utl_smtp to send an HTML email, I'm passing in a clob to utl_smtp.data (), works very well for some emails small relativley is no bigger nut, which return the following error

    ORA-06502: PL/SQL: digital error or value

    Does anyone know what the limitation is the size if the parameter of body to utl_smtp.data (), and is there another way to send large mails?

    Thank you...

    refer to this

    http://www.Oracle-base.com/articles/Misc/email-from-Oracle-plsql.php

    http://asktom.Oracle.com/pls/asktom/f?p=100:11:3366784949717501:P11_QUESTION_ID:1739411218448

  • Question by adding the LOBs-ORA-06502: PL/SQL: digital error or value

    Hello

    I'm using Oracle 11 g.

    I have a requirement in which I need to add LOBs and I must insert the LOB in a table column. I am facing problem when the data exceeds certain limits. My program works like the following:

    (Please note that my program logic is given below, not the exact program)

    DECLARE

    final_html CLOB.
    int_html CLOB.
    v_str VARCHAR2 (32767).

    i the number: = 0;

    BEGIN


    DBMS_LOB.CREATETEMPORARY (lob_loc = > int_html, CACHE = > TRUE, hard = > dbms_lob.) CALL);
    DBMS_LOB.CREATETEMPORARY (lob_loc = > final_html, CACHE = > TRUE, hard = > dbms_lob.) CALL);
    DBMS_LOB. OPEN (int_html, DBMS_LOB. LOB_READWRITE);
    DBMS_LOB. OPEN (final_html, DBMS_LOB. LOB_READWRITE);
    dbms_output. ENABLE (1000000);


    FOR i 1,100 loop

    v_str: = "< b >" |
    "< style td =" "DRESSING: break-word" width = "50" > < font size = "2" > ' | "
    I have | ' < / police > < table > ' |
    "< /tr >";

    DBMS_LOB. WriteAppend (lob_loc = > int_html, amount = > LENGTH (v_str), BUFFER = > v_str);


    END LOOP;
    dbms_output.put_line (' the length of the int_html is :'||) DBMS_LOB. GetLength (int_html));

    dbms_output.put_line (' the int_html :'|| is int_html).

    final_html: = "< html >" | int_html | "< / html > ';
    dbms_output.put_line (' the final_html :'|| is final_html).



    EXCEPTION
    WHILE OTHERS THEN


    dbms_output.put_line(SQLCODE||) e -'|| SQLERRM);
    DBMS_LOB. CLOSE (int_html);
    DBMS_LOB. CLOSE (final_html);
    DBMS_LOB. FREETEMPORARY (int_html);
    DBMS_LOB. FREETEMPORARY (final_html);

    END;


    When the loop is made of lesser value, say FOR example, the loop i IN 1.10, the program works very well, but when the closure is done for values more I'm ' - 6502-ORA-06502: PL/SQL: digital error or value ' error message.

    Please help me solve this problem.

    Thanking you in advance.


    Kind regards
    Sri

    Can you please specify what environment you run this?

    I modified your code as follows

    The code executed successfully until the length has been<= 32767="" i.e="" (="" until="" for="" i="" in="">

    In addition, you must use the function APPEND to concatenate variables clob.

    Please check the maximum size by default for varchar2 or dbms_output in your server since you get the error for just the loop in the range (FOR i IN 1,100).

    And Yes, Siva comments are valid.

    DECLARE

    final_html CLOB.
    int_html CLOB.
    v_str VARCHAR2 (32767).

    i the number: = 0;

    BEGIN

    DBMS_LOB.CREATETEMPORARY (lob_loc-online int_html, CACHE-online TRUE, hard-online dbms_lob. CALL);
    DBMS_LOB.CREATETEMPORARY (lob_loc-online final_html, CACHE-online TRUE, hard-online dbms_lob. CALL);
    DBMS_LOB. OPEN (int_html, DBMS_LOB. LOB_READWRITE);
    DBMS_LOB. OPEN (final_html, DBMS_LOB. LOB_READWRITE);
    dbms_output. ENABLE (1000000);

    FOR i 1.1092 loop

    v_str: = '' ||
    '' ||
    I have | '' ||
    '';

    DBMS_LOB. WriteAppend (lob_loc-int_html, amount => (v_str), BUFFER LENGTH-online v_str online);

    END LOOP;

    dbms_output.put_line (' the length of the int_html is :'||) DBMS_LOB. GetLength (int_html));
    Start
    dbms_output.put_line (' the int_html :'|| is int_html).
    dbms_output.put_line (' the length of the int_html is :'||) DBMS_LOB. GetLength (int_html));
    exception when others then
    dbms_output.put_line(SQLCODE||) e -'|| SQLERRM);
    end;
    /*
    Start
    final_html: = ''|| int_html | »';
    dbms_output.put_line (' the final_html :'|| is final_html).
    exception when others then
    dbms_output.put_line(SQLCODE||) e -'|| SQLERRM);
    end; */

    EXCEPTION
    WHILE OTHERS THEN

    dbms_output.put_line(SQLCODE||) e -'|| SQLERRM);
    DBMS_LOB. CLOSE (int_html);
    DBMS_LOB. CLOSE (final_html);
    DBMS_LOB. FREETEMPORARY (int_html);
    DBMS_LOB. FREETEMPORARY (final_html);

    END;

    Published by: Gurnani houta July 29, 2011 03:11

    Published by: Gurnani houta July 29, 2011 03:14

  • product loop "ORA-06502: PL/SQL: digital error or value."

    Why I get the error message ' ORA-06502: PL/SQL: digital error or value "to the code below.
    create table bc (
      a number, 
      b varchar2(10)
    );
    
    
    declare
      type t_bc_a is table of bc.a%type;
      type t_bc_b is table of bc.b%type;
      l_bc_a t_bc_a;
      l_bc_b t_bc_b;
    begin
      dbms_output.put_line('1');
      select a, b bulk collect into l_bc_a, l_bc_b from bc;
       dbms_output.put_line('2');
       if l_bc_a is null then
         dbms_output.put_line('2.1'); 
       else
         dbms_output.put_line('2.2, l_bc_a.count=' || l_bc_a.count); 
         
       end if;
      for i in l_bc_a.first .. l_bc_a.last loop
       dbms_output.put_line('3');
        dbms_output.put_line(l_bc_a(i) || ', ' || l_bc_b(i));
      end loop;
    end;
    
    /*
    1
    2
    2.2, l_bc_a.count=0
    ORA-06502: PL/SQL: numeric or value error
    */
    "Bc" table is empty and I expect loop never to do any cycle a step, but I get the error. Why the error is there.

    Hello!

      for i in l_bc_a.first .. l_bc_a.last loop
       dbms_output.put_line('3');
        dbms_output.put_line(l_bc_a(i) || ', ' || l_bc_b(i));
      end loop;
    

    In your case, l_bc_a.first is null and l_bc_a.last is the same

    in the case

    because me to null... loop of null

    such an error is returned

    T

  • ORA-06502: PL/SQL: digital error or value, ORA-06512: online

    I'm trying to do something like that. The application works well and returns a few rows when run independently. But the script gives error:
    ORA-06502: PL/SQL: digital error or value
    ORA-06512: at line 108

    DECLARE
    QCURSOR SYS_REFCURSOR;
    QUERYCONTEXT DBMS_XMLGEN. CTXHANDLE;
    RESULT CLOB.
    RXML XMLType.
    BEGIN
    OPEN QCURSOR TO SELECT
    SOMECOLUMN1 "Label1"
    .
    .
    .
    .

    FROM SOMETABLE;


    queryContext: = DBMS_XMLGEN.newContext (qcursor);

    DBMS_XMLGEN.setRowSetTag (queryContext, 'Message');
    DBMS_XMLGEN.setRowTag (queryContext, 'Record');
    DBMS_XMLGEN.setNullHandling (queryContext DBMS_XMLGEN. EMPTY_TAG);

    -To get the result
    result: = DBMS_XMLGEN.getXML (queryContext);

    -Narrow context
    DBMS_XMLGEN.closeContext (queryContext);

    NARROW Qcursor;

    Train IS NULL THEN
    DBMS_OUTPUT. PUT_LINE ('(NULL)');
    ON THE OTHER
    DBMS_OUTPUT. Put_line (result); -Line 108
    END IF;
    END;

    Could not understand what the problem is? Any ideas?

    Omer

    The result is CLOB, I remember that they must be treated differently (not via dbms_output.put_line).

    Something like:

    dbms_output.put_line (DBMS_LOB. GetLength (l_xmlclob));
    -display the content of CLOB
    LOOP
    l_loc: = dbms_lob.instr (l_xmlclob, Chr (10), l_anc);
    l_text: = dbms_lob.substr (l_xmlclob, l_loc - l_anc, l_anc);
    l_anc: = l_loc + 1;
    dbms_output.put_line (l_text);
    WHEN OUTPUT l_loc = 0;
    END LOOP;

  • Function return undefined values

    My function returns undefined values. It seems that the return of the function statement is executed before the database is queried and values are assigned to variables. If I do an alert within the loop for () I get the correct values from the database, but these values are not affected before excecuting the return statement function. How can I do this differently?

    function getColumnNames(table){
        var rs1, rs2, rs3, rs4, rs5;
        db.transaction(function (tx) {
            tx.executeSql("SELECT * FROM schema WHERE table_name=?",[table], function(ax, results){
                var size = results.rows.length, i;
                var item;
                for (i = 0; i < size; i++){
                    item = results.rows.item(i);
                    rs1 = item.col1;
                    rs2 = item.col2;
                    rs3 = item.col3;
                    rs4 = item.col4;
                    rs5 = item.col5;
                                    alert(rs1); //correct value is returned here
                }
            });
        });
        return [rs1, rs2, rs3, rs4, rs5];
    }
    

    Hey Fabian,.

    You are quite correct that the return statement is executed before the database returns the results. There are ongoing asynchronous calls. You can set breakpoints in JavaScript code to see what is happening. You can correct the problem by using function callbacks. I edited your code below to use the callback functions - there might be a few typos, but the general approach should be wooded.

    function getColumnNames(table, callback){
        var rs1, rs2, rs3, rs4, rs5;
        db.transaction(function (tx) {
            tx.executeSql("SELECT * FROM schema WHERE table_name=?",[table], function(ax, results){
                var size = results.rows.length, i;
                var item;
                for (i = 0; i < size; i++){
                    item = results.rows.item(i);
                    rs1 = item.col1;
                    rs2 = item.col2;
                    rs3 = item.col3;
                    rs4 = item.col4;
                    rs5 = item.col5;
                        alert(rs5); //correct values are being returned
                    callback([rs1, rs2, rs3, rs4, rs5]);
                }
            });
        });
    }
    
    // example of how to call getColumnNames with callback
    getColumnNames('importantTable', function (result)
    {
        console.log(result);
    });
    
    // alternative version
    function onCallback(result)
    {
        console.log(result);
    }
    
    getColumnNames('importantTable', onCallback);
    

    I hope this helps.

    See you soon,.

    James

  • Do stuff to PL/SQl that returns the value and redirect to modal page by setting this value

    Hello

    a button click Page1 I would perform a PL/SQL procedure that returns a value in P1_ITEMVAL and then redirect to a page 2 (modal page) and the value of an item on this page with the value previously returned. To do the same thing with a normal page is quite easy:

    Button action is present, then process of PL/SQL that returns the value in the P1_ITEMVAL element and, finally, a branch at page 2 that sets P2_ITEMVAL with P1_ITEMVAL. I really have no idea how to do the same thing when the target is a modal page.

    I created a unit test on https://apex.oracle.com/pls/apex (application 1554 - redir_to_modal)

    Workspace: tests

    USER: supporter

    PWD: supporter1234

    Any help would be much appreciated.

    Kind regards

    Pavel

    Pavel

    If you prepare a URL using the value calculated in the PLSQL of DA part you can then use a subsequent stage of javascript to set the location of the window.

    This will jump to the top of the page of the modal dialog box

    : P1_URL: = apex_util.prepare_url)

    ' f ? p ='|| : APP_ID - Application id

    |': 2' - Page id

    ||': ' || : APP_SESSION - Session id

    ||':'                      -- Request

    ||':NO'                    -- Debug

    : ': ' - Clear Cache

    : ': ' - Settings

    ||' P2_ITEMVAL'

    : ': ' - Parameter values

    || (: P1_ITEMVAL);

    then in the action of javascript

    Window.Location.Replace ($v ('P1_URL'));

    Hope this is of some use

    Concerning

    Kelvin

  • reload the page when SQL query returns a value

    Hello world

    the title of this discussion may seem strange, but I'll try to explain why I need this:

    A user has the ability to connect on my APEX application. There are several tabs in my application that are visible only if a certain SQL statement returns a value which is not the case by default. The user has also the ability to download a file that is transferred to an external system that analyzes the file and writes the data in the database. During this writing process - which may take several minutes - conditions for some of the tabs to show the will becomes real (-> the query will return a value). When the user refreshes the page manually, the tabs will be displayed. However, I want the tabs will appear automatically when the condition is met.

    Is it possible to refresh the page as soon as the query returns a value? It is perhaps possible to check it on the client side and trigger a refresh of the page when the condition is met. It would be even better if only the tabset has been updated, but refreshing the full page is fine as well.

    Thank you!

    Here is an overview of how it can be done

    This is possible thanks to a dynamic action being performed on a timer.

    View default tabs and dynamic action hide them on loading the page if they are not to be considered

    Create a dynamic action that will execute your query every 5 seconds or more

    If the query returns data, you can use the dynamic action to show your tabs using javascript

Maybe you are looking for

  • Problems with 10.11.6 updated

    Mail does not open. Cannot open the file Banktivity 5.6.9.

  • Pavilion dv3500 - FZ941PA #ABG: needs TO RESTART IN EVERY FIRST OPENING MY LAPTOP

    Hello! Nice day! Why should I restart my laptop at every opening, if I don't restart and it is lagging, and I try to reformat it (original OS) Vista for Windows 7 32 bit. In everyday life, I opened my laptop that I need to reboot before you can begin

  • Office update problem

    I am running MS Office Enterprise 2007 on a Windows 7 x 64 system. Everything was going well until the SP2 Office and/or related patches have been installed by Windows Update on my computer two days ago. Now when I try to run any MS Office, I get two

  • The upgrade card NIC to onboard LAN, Windows 7

    Hello everyone. Have a basic question for the upgrade of the Ethernet card or the card NETWORK on my Compaq Presario under W7 Home Premium. Initially, this machine ran Vista. I installed a PCI 3Com NIC {3Com EtherLink 10/100 PCI TX NIC (3C905B-TX)}.

  • How to download microsft word

    I have windows vista installed on my laptop and im trying to install microsoft word. However, the cd that came with the computer has windows xp... and I'm not sure how to download from there