Pl sql hex to raw conversion error

Hello gurus,

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

Tags: Database

Similar Questions

  • 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.

  • ORA-06502: PL/SQL: digital error or the value in the conversion for a long TIME on the CLOB type

    Hello

    I have an EA of RDBMS Oracle 11.2.0.4.

    I ger the following error when I try to convert a data type LONG to type CLOB data thanks to a PL/SQL procedure:

    declare
    v_prefix varchar2 (20): = null;
    v_text_view_clob clob: = null;
    long v_text_view_long: = null;

    cursor c_v
    is
    Select
    a.view_name as view_name
    Of
    USER_VIEWS one;

    Start
    for r_v in c_v
    loop
    Start
    v_text_view_clob: = null;
    v_text_view_long: = null;

    -Do the SQL code of the view
    Select
    a.Text text
    in
    v_text_view_long
    Of
    USER_VIEWS one
    where
    a.view_name = r_v.view_name;

    v_text_view_clob: = v_text_view_long;

    update of ohibo_views one
    set
    a.view_text = v_text_view_clob
    where
    a.view_name = r_v.view_name;
    exception
    while others then
    dbms_output.put_line (‘View =’ | r_v.view_name |) «kan niet worden geconverteerd!»);
    dbms_output.put_line (substr (sqlerrm, 1, 60));
    end;
    end loop;
    -commit;
    exception
    while others then
    lift;
    end;
    /

    I get the error a specific record:

    View = VER_POLISMUTATIES_VW kan niet worden geconverteerd!

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

    At looked the origina; Value of type LONG and it is indeed a «long» piece of text.

    However, CLOB has a restriction about 4G * db_block_size and LONG 2 G — 1 according to the documentation.

    I should be able with the method above to convert a LONG in CLOB.

    Anyone had a similar situation?

    Thanks in advance for advice how to solve.

    Kind regards

    PS: my apologies, I didn’t know which group to post this discussion: database or PL/SQL.

    Good indeed, a link with the right explanation.

    I didn’t know that there was such a function.

    Thank you!

    Kind regards

  • 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.

  • 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:

    [email protected] > 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

  • Error processing request. ORA-06502: PL/SQL: digital error or value OK

    Hello

    I want to open a session in an APEX application using the IE 8 browser, but I can’t because this error:

    Error Error processing request.
    ORA-06502: PL/SQL: digital error or value
    Ok

    I can run this app with Chrome or Mozilla, but I need to open it with IE.

    Can you please tell me how should I solve this problem?

    Thank you

    It is a problem with your version of APEX that you use… There was a patch released about 6 months ago… or you can just upgrade to the latest version. I also had this problem, and there are several similar topics in this forum about the exact problem and at least the a precise details on the patch/fix.

  • 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

  • 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

  • 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

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

    Hello

    I am facing a problem with my lexical parameter. I have a requirement where I have to pass a string to the db column. I think that I am facing problem with quotes. Please find the sample code below:

    : lp_trans_type: = «» AND (RSV.transaction_type <>»F» OR RSV.transaction_type is NULL);»

    The report compiles suceccfully but when run from window SRS that generates an error

    REP-1401: «afterpform»: PL/SQL unrecoverable error occurred.
    ORA-06502: PL/SQL: digital error or value

    Please help me how to set up the string within a string. Or please suggest a possible solution.

    Thanks in advace.

    Kind regards
    Prakash

    Check the data type and length of lp_trans_type.

    This is not the error, but will not work your query:

    RSV.transaction_type «F»

    You forgot the =.

    Published by: InoL on July 20, 2010 12:57

  • 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;

  • ORA-06502: PL/SQL: digital error: error in the conversion of char to number

    Hello world.

    I have a strange problem here. I’ll try to explain better. I work with APEX 4.2 and of Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 — 64 bit Production.

    Here are my parameters NLS_SESSION_PARAMETER and NLS_DATABASE_PARAMETER: NLS_NUMERIC_CHARACTERS,.

    I have a table with a lot of body numbers, and when I imported a MS Access application data, all fields were imported with the comma as decimal separator.

    Now, I have a form with several fields of number and when I leave a numeric field, a body of numbers of amount total is calculated and automatically filled with a bit of javascript.

    Now the problem: calculating fields (sum) succeeds only when I use the decimal as the delimiter. If I use the comma, I get a NaN value in the total amount field. I managed to convert all commas in points with javascript, so the total amount is calculated.

    When I try to save the record, I get the error: ORA-06502: PL/SQL: digital error: error in the conversion of char to number because I’m trying to save the separator point in my number fields.

    I tried to use REPLACE function to replace the. by one, before winning but does not solve the problem.

    This sounds familiar to anyone?

    Thanks in advance.

    OK, the problem is solved people.

    Somehow, the registration procedure had an influence on another calculation of my form and the error came from this process. So I put a to_number and replace stated in the calculation and all records very well and it shows my total.

  • ORA-06502: PL/SQL: digital error or value: the value of key NULL index table?

    Hello

    Can someone let me know what is the problem the code below and how can we avoid this? I get the error message as below

    ORA-06502: PL/SQL: digital or value error: NULL index key value table

                        v_while_loop := 1;
                        v_delete_char_id := v_tabtype_result_values.FIRST;
                        WHILE v_while_loop <> v_tabtype_result_values.COUNT 
                        LOOP
                            IF check_duplicate_nc_data (v_result_view, 
                                                        v_tabtype_result_values(v_delete_char_id).value,
                                                        v_collection_id,
                                                        v_occurrence,
                                                        v_plan_id,
                                                        v_delete_char_id
                                                        )
                            THEN
                                DBMS_OUTPUT.PUT_LINE(v_delete_char_id);
                                v_tabtype_result_values.DELETE(v_delete_char_id);
                            ELSE
                                DBMS_OUTPUT.PUT_LINE(v_delete_char_id||','||v_tabtype_result_values(v_delete_char_id).id||','
                                                        ||v_tabtype_result_values(v_delete_char_id).value||','
                                                        ||v_tabtype_result_values(v_delete_char_id).validation_flag
                                                        );
                            END IF;
    
                            v_while_loop := v_while_loop + 1;
                            v_delete_char_id := v_tabtype_result_values.NEXT(v_delete_char_id);
                        END LOOP;

    Change:

    WHILE v_while_loop <> v_tabtype_result_values.COUNT 
    

    TO

    WHILE v_while_loop <= v_tabtype_result_values.LAST
    

    SY.

  • Validation of the APEX: ORA-06502: PL/SQL: digital error or value:

    Hello

    I need help for validation. The user set to ‘ field minutes'(besoin d’un nombre compris entre 0 et 59).

    My solution is to do two commits:

    1 — no number:
    Name: P1_MINUTES
    Type: Regular Expression
    Validation expression 1: P1_MINUTES
    ({Validation expression 2: ^ d{1,5}(.d{1,2})? $

    2. more high level then 59:
    Name: P1_MINUTES
    Type: Function return Boolean
    1 validation expression:
    If: P10_TOT_MINUTEN < 60 then
    Returns true;
    on the other
    Returns false;
    end if;
    Validation expression 2: -.

    2 validation gives this error (for example a = m value):
    ORA-06502: PL/SQL: digital or value error: character number conversion error — the reason is clear m value is not numeric

    How this problem can be solved!

    Condition 2 validation by using a condition of PL/SQL Expression:

    regexp_like(:p1_minutes, '^d{1,5}(.d{1,2})?$')
    

Maybe you are looking for

  • tried everything to no problems printing — no luck

    Hi, since I upgraded to El Capitan my macbook air was not able to see the printers on my network wifi or connected via USB. I fixed it once (I kept trying things and eventually they both show) but they disappeared a few days later and today I tried p

  • Qosmio F45-AV413 refurbished showing DMI.exe error when trying to restore

    Here’s the problem: I formatted the original disc to install Vista in another language with my own Vista disc.After that, I couldn’t do some drivers to work properly, so I decided to do a system restore.I didn’t have the disc so I asked Toshiba for s

  • Qosmio E10: Bluetooth is not ready — but Fn + F8 is enabled

    HelloI have a laptop Toshiba Qosmio E10. I can’t get a bluetooth headset to work with her. I set up the Bluetooth Manager, but when I click on new connection box appears: «Bluetooth is not ready.» I pressed Fn + F8 and it is said that Bluetooth is tu

  • Auto update is on, but does not work

    I always had the automatic updates set to automatic and have not changed this setting, but I get a red shield with a message that automatic updates are not running.  I ran the patch program, and which is not correct the problem.  I am running Windows

  • error 800706ba on XP when running Live MSM

    When you run live MSM on XP, Live won’t open and error 800706ba with corrupted data calendar description

I am having problem with a sproc which accepts a Raw parameter.
I have a table called Profile:
CREATE TABLE PROFILES
PROFILEID INTEGER NOT NULL,
USERID INTEGER NOT NULL,
PROFILE RAW(255)
and a sproc named addprofile
CREATE OR REPLACE PROCEDURE addprofile
profile IN RAW,
userName IN VARCHAR2
AS
userId INT;
BEGIN
GetUserIdByName( userName, userId);
INSERT INTO Profiles
( ProfileID,userId , profile )
VALUES ( Profiles_ProfileID_SEQ.NEXTVAL,AddProfile.userId ,
AddProfile.profile );
END;
I am calling the Ent Library’s Insert profile method which is part of DbProfileProvider.cs (Security App block). It is trying to persist a serialized profile object into the database.
private void InsertProfile(string userName, byte[] serializedProfile,
Data.Database securityDb, IDbTransaction transaction)
DBCommandWrapper cmd = securityDb.GetStoredProcCommandWrapper
(SPAddProfile);
cmd.AddInParameter(«userName», DbType.String, userName);
cmd.AddInParameter(«profile», DbType.Binary, serializedProfile);
securityDb.ExecuteNonQuery(cmd, transaction);
I get the following error:
Any suggestion on what needs to be changed to get this working? thanks!
Exception Details: Oracle.DataAccess.Client.OracleException: ORA-06502: PL/SQL: numeric or value error: hex to raw conversion error ORA-06512: at line 1
Stack trace:
[OracleException: ORA-06502: PL/SQL: numeric or value error: hex to raw conversion error
ORA-06512: at line 1]
Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure)
Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, String procedure, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src)
Oracle.DataAccess.Client.OracleCommand.ExecuteNonQuery()
Microsoft.Practices.EnterpriseLibrary.Data.Database.DoExecuteNonQuery(DBCommandWrapper command)
Microsoft.Practices.EnterpriseLibrary.Data.Database.ExecuteNonQuery(DBCommandWrapper command, IDbTransaction transaction)
Microsoft.Practices.EnterpriseLibrary.Security.Database.DbProfileProvider.InsertProfile(String userName, Byte[] serializedProfile, Database securityDb, IDbTransaction transaction)
Microsoft.Practices.EnterpriseLibrary.Security.Database.DbProfileProvider.SetProfile(IIdentity identity, Object profile)
[InvalidOperationException: Error saving the profile for the following user ‘test’.]
Microsoft.Practices.EnterpriseLibrary.Security.Database.DbProfileProvider.SetProfile(IIdentity identity, Object profile)
EntLibSecuritySample.DFO.Security.SecurityHelper.SetUserProfile(IIdentity identity, Object Profile) in C:DFOSampleSecurityEntLibSecuritySampleSecurityHelper.vb:285
[ApplicationException: An error has occurred saving profile object to Datastore. See stack trace for further information]
EntLibSecuritySample.DFO.Security.SecurityHelper.SetUserProfile(IIdentity identity, Object Profile) in C:DFOSampleSecurityEntLibSecuritySampleSecurityHelper.vb:287
EntLibSecuritySample.ProfilePage.cmdSaveProfile_Click(Object sender, EventArgs e) in C:DFOSampleSecurityEntLibSecuritySampleprofile.aspx.vb:59
System.Web.UI.WebControls.Button.OnClick(EventArgs e)
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain() +1292

Harsh,
I am not a user of the Enterprise Library so I can not speak to the specifics of that. However, here is a short sample that is based on the information you’ve provided. Perhaps it will be useful.
Database:
create table profiles
  profileid integer not null,
  userid    integer not null,
  profile   raw(255)
create or replace procedure addprofile
  p_profileid in integer,
  p_userid    in integer,
  p_profile   in raw
as
begin
  insert into
    profiles (profileid, userid, profile)
    values (p_profileid, p_userid, p_profile);
end;
/C# code:
using System;
using System.Data;
using System.Text;
using Oracle.DataAccess.Client;
using Oracle.DataAccess.Types;
namespace HarshTest
  /// <summary>
  /// Summary description for Class1.
  /// </summary>
  class Class1
    /// <summary>
    /// The main entry point for the application.
    /// </summary>
    [STAThread]
    static void Main(string[] args)
      // connect to local db using o/s authentication
      OracleConnection con = new OracleConnection(«User ID=/; Pooling=False»);
      con.Open();
      // create command object and set properties
      OracleCommand cmd = new OracleCommand();
      cmd.Connection = con;
      cmd.CommandText = «ADDPROFILE»;
      cmd.CommandType = CommandType.StoredProcedure;
      // parameter object for profileid
      OracleParameter p_profileid = new OracleParameter();
      p_profileid.OracleDbType = OracleDbType.Int32;
      p_profileid.Value = 1;
      p_profileid.Direction = ParameterDirection.Input;
      // parameter object for userid
      OracleParameter p_userid = new OracleParameter();
      p_userid.OracleDbType = OracleDbType.Int32;
      p_userid.Value = 1;
      p_userid.Direction = ParameterDirection.Input;
      // create a byte array for the raw value
      ASCIIEncoding encoder = new ASCIIEncoding();
      byte[] byteArray = encoder.GetBytes(«TestProfile»);
      // parameter object for profile
      OracleParameter p_profile = new OracleParameter();
      p_profile.OracleDbType = OracleDbType.Raw;
      p_profile.Value = byteArray;
      p_profile.Direction = ParameterDirection.Input;
      // add parameters to collection
      cmd.Parameters.Add(p_profileid);
      cmd.Parameters.Add(p_userid);
      cmd.Parameters.Add(p_profile);
      // execute the stored procedure
      try
        cmd.ExecuteNonQuery();
      catch (OracleException ex)
        Console.WriteLine(ex.Message);
      // clean up objects
      p_profile.Dispose();
      p_userid.Dispose();
      p_profileid.Dispose();
      cmd.Dispose();
      con.Dispose();
}Maybe the part about creating the byte array is what you are missing…
— Mark

Similar Messages

  • Web service call on hosted env fails with hex to raw conversion error

    Hi,
    I use Enciva to run some hosted Apex applications, and I’ve had a call open with them for a few days re: setting up a web service call to an e-mail checker, provided by a company called Rolosoft. The e-mail checker runs fine from outside the hosted environment, but I get the following error trying to call from the Apex application:
    ORA-06502: PL/SQL: numeric or value error: hex to raw conversion error
    Has anyone hit this error before with web services, I’ve tried manual and RESTful but get the same error message.
    Thanks,
    Mike

    Hello,
    We encounter the same issue using manual WebService !
    Environnement Settings :
    Oracle 11g R2 — Windows W2K3 — NLS_CHARACTERSET : AL32UTF8
    Apex 4.1
    Any suggestions, helps ?
    Thanks,
    G.

  • Numeric or value error: character to number conversion error

    I’m having problems inserting a value from a date picker field (DD-MON-YYYY HH MI )
    i’m submitting this value to a packaged procedure that accepts this field as VARCHAR2 .
    on the insert, i do a to_date( P_DATE, ‘DD-MON-YYYY HH:MI PM’ )
    and i get the numeric conversion error.
    If I change the to_date on the procedure side, I get the :could not read the end of the format mask — which I’ve found threads about on this site.
    I’ve tried using HH24 and different formats, but I get one of the two above errors on the insert.
    If I don’t fill in the datepicker field at all, it works fine.
    help is appreciated !
    Bill

    Here is the trace anyway:
    *** ACTION NAME:(application 4000, page 1) 2004-09-24 12:58:44.052
    *** MODULE NAME:(HTML DB) 2004-09-24 12:58:44.052
    *** SERVICE NAME:(TOPS) 2004-09-24 12:58:44.052
    *** SESSION ID:(151.1) 2004-09-24 12:58:44.052
    *** 2004-09-24 12:58:44.052
    ksedmp: internal or fatal error
    ORA-06502: PL/SQL: numeric or value error: character to number conversion error
    Current SQL statement for this session:
    declare
    rc__ number;
    begin
    owa.init_cgi_env(:n__,:nm__,:v__);
    htp.HTBUF_LEN := 255;
    null;
    null;
    null;
    null;
    f(p=>:p);
    if (wpg_docload.is_file_download) then
    rc__ := 1;
    wpg_docload.get_download_file(:doc_info);
    null;
    null;
    null;
    commit;
    else
    rc__ := 0;
    null;
    null;
    null;
    commit;
    owa.get_page(:data__,:ndata__);
    end if;
    :rc__ := rc__;
    end;
    —— PL/SQL Call Stack ——
    object line object
    handle number name
    6A3C4A00 532 package body FLOWS_010500.WWV_FLOW_UTILITIES
    6A3C4A00 2502 package body FLOWS_010500.WWV_FLOW_UTILITIES
    6A3C4A00 2748 package body FLOWS_010500.WWV_FLOW_UTILITIES
    6A0E63C8 991 package body FLOWS_010500.WWV_FLOW_FORMS
    6A11675C 932 package body FLOWS_010500.WWV_FLOW_DISP_PAGE_PLUGS
    6A11675C 247 package body FLOWS_010500.WWV_FLOW_DISP_PAGE_PLUGS
    6A4B54E0 8341 package body FLOWS_010500.WWV_FLOW
    6A2A99F0 102 procedure FLOWS_010500.F
    6A2B9E54 10 anonymous block
    —— Call Stack Trace ——
    calling call entry argument values in hex
    location type point (? means dubious value)
    ksedmp+524          CALLrel  ksedst+0 1
    ksedmptracecb+15 CALLrel _ksedmp+0            C
    _ksddoa+118          CALLreg  00000000             C
    ksdpcg+143          CALLrel  ksddoa+0
    ksdpec+180          CALLrel  ksdpcg+0 1966 6D7D208 1
    __PGOSF3__ksfpec+11 CALLrel _ksdpec+0            0
    8
    _kgerev+77           CALLreg  00000000             7474210 1966
    kgerec1+18          CALLrel  kgerev+0 7474210 6DCE5EC 1966 1
    6D7D260
    peirve+465          CALLrel  kgerec1+0
    pevmCVTCN+346 CALLrel _peirve+0           
    pfrinstrCVTCN+36 CALLrel pevmCVTCN+0 6E6E604 71CE370 7160F0C
    pfrrunno_tool+51 CALL??? 00000000
    pfrrun+1834         CALLrel  pfrrun_no_tool+0 6E6E604 6A3C010A 6E6E640
    plsqlrun+1051 CALLrel _pfrrun+0            6E6E604
    peicnt+179          CALLrel  plsql_run+0 6E6E604 1 0
    kkxexe+477          CALLrel  peicnt+0
    opiexe+4896         CALLrel  kkxexe+0 6A2B9E54
    kpoal8+1705         CALLrel  opiexe+0 49 3 6D7E06C
    _opiodr+977          CALLreg  00000000             5E 14 6D7E7CC
    _ttcpip+1827         CALLreg  00000000             5E 14 6D7E7CC 0
    _opitsk+1098         CALL???  00000000            
    opiino+938          CALLrel  opitsk+0 0 0 747ABC0 6DEFB14 D8 0
    _opiodr+977          CALLreg  00000000             3C 4 6D7FBBC
    opidrv+479          CALLrel  opiodr+0 3C 4 6D7FBBC 0
    sou2o+45            CALLrel  opidrv+0 3C 4 6D7FBBC
    opimai+237          CALLrel  sou2o+0
    [email protected]  CALLrel  opimai+0
    4+899
    77E7D338 CALLreg 00000000

  • Re: Error, numeric or value error: character to number conversion error

    Can someone please please tell me why I’m getting this error and what I’m doing wrong? It looks like a simple error, «numeric or value error: character to number conversion error».
    My code is as follows:
    string connectionString = WebConfigurationManager.ConnectionStrings[«DEMO_TEST»].ConnectionString;
    OracleConnection con = new OracleConnection(connectionString);
    OracleCommand cmd = new OracleCommand(«DEMO.PKG_LOCATION_TYPE.INS», con);
    cmd.CommandType = CommandType.StoredProcedure;
    cmd.Parameters.Add(new OracleParameter(«@P_DESCRIPTION», OracleDbType.Varchar2, 60));
    cmd.Parameters[«@P_DESCRIPTION»].Value = «Test_Description»;
    cmd.Parameters.Add(new OracleParameter(«@P_NAME», OracleDbType.Varchar2, 6));
    cmd.Parameters[«@P_NAME»].Value = «Test_Name»;
    cmd.Parameters.Add(new OracleParameter(«@P_LOCATION_TYPE_CD», OracleDbType.Decimal, 4));
    cmd.Parameters[«@P_LOCATION_TYPE_CD»].Direction = ParameterDirection.InputOutput;
    con.Open();
    try
    cmd.ExecuteNonQuery();
    catch
    //In case of an error
    finally
    con.Close();
    con.Dispose();
    And I recieve the following error block:
    Oracle.DataAccess.Client.OracleException was unhandled by user code
    Message=»ORA-06502: PL/SQL: numeric or value error: character to number conversion errornORA-06512: at line 1″
    Source=»Oracle Data Provider for .NET»
    DataSource=»demotest»
    Number=6502
    Procedure=»DEMO.PKG_LOCATION_TYPE.INS»
    StackTrace:
    at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure)
    at Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, String procedure, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src)
    at Oracle.DataAccess.Client.OracleCommand.ExecuteNonQuery()
    at System.Web.UI.WebControls.Wizard.OnFinishButtonClick(WizardNavigationEventArgs e)
    at System.Web.UI.WebControls.Wizard.OnBubbleEvent(Object source, EventArgs e)
    at System.Web.UI.WebControls.Wizard.WizardChildTable.OnBubbleEvent(Object source, EventArgs args)
    at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
    at System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e)
    at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
    at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
    at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
    at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    ********************************************************

    Are the parameters in your procedure in the same order as they are created in this code? Oracle command works by position unless you change it to be BindByName.
    Failing that you seem to have defined a parameter (P_NAME) to have a length of 6, and are then setting it’s value to a string with a length of 9.
    Also the in/output parameter is defined as type decimal. Is this correct? It is defined as InputOutput but you don’t assign it any value.
    If these suggestions don’t help then perhaps if you post the stored procedure you might get some more ideas.
    HTH
    Lyndon

  • PL/SQL: numeric or value error: character to number conversion error in TRG

    Hi,
    I’ve got strange issue with one trigger which during update of table reports (DB is 9.2.0.8):
    ORA-06502: PL/SQL: numeric or value error: character to number conversion error
    ORA-06512: at «UDR_LOG», line 345
    ORA-04088: error during execution of trigger ‘UDR_LOG’but line 345 is:
    END IF;
    so its kind of strange
    the code looks like
    343 IF nvl(to_char(:old.PKD_ID),»») <> nvl(to_char(:new.PKD_ID),»») THEN
    344     v_zmn := v_zmn || ‘PKD_ID»’ || to_char(:old.PKD_ID) || »» || to_char(:new.PKD_ID) || »»;
    345    END IF;
    so its concatenation not to_number usage .error is triggered by update statement on any column .
    I’m sorry I cant provide You with whole trigger code .
    So if You could only recommend any investigation method that would be great .
    Regards
    Greg

    Hi, Greg,
    When there’s an error in a trigger, the line numbers in the error messages are relative to the first DECLARE or BEGIN statement; often, that’s a few lines after CREATE OR REPLACE TRIGGER. Post a few lines after what you already posted.
    If you can’t find the error, then create another table for testing this, and create a smaller trigger on that table, which does only enough to cause the error. Then you’ll be able to post the complete trigger, and the code needed to re-create the problem.

  • ORA-06502: numeric or value error: character to number conversion error

    I met the following error when I ran Donald’s PL/SQL function to_number_or_null. Could somebody here help me find the resolution? Thanks!
    SQL> create or replace FUNCTION to_number_or_null (
    2 aiv_number in varchar2 )
    3 return number is
    4 /*
    5 to_number_or_null.fun
    6 by Donald J. Bales on 12/15/2006
    7 An errorless to_number( ) method
    8 */
    9 begin
    10 return to_number(aiv_number);
    11 exception
    12 when INVALID_NUMBER then
    13 return NULL;
    14 end to_number_or_null;
    15 /
    Function created.
    SQL> select to_number_or_null(‘A’) from dual;
    select to_number_or_null(‘A’) from dual
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error: character to number conversion error
    ORA-06512: at «CAROL.TO_NUMBER_OR_NULL», line 10

    Only INVALID_NUMBER exception is handled and also VALUE_ERROR should be handeled. You can resolve it by handling VALUE_ERROR exception or by adding WHEN OTHERS as I did in following example.
    SQL> create or replace FUNCTION to_number_or_null (
      2      aiv_number in varchar2 )
      3      return number is
      4     /*
      5     to_number_or_null.fun
      6     by Donald J. Bales on 12/15/2006
      7     An errorless to_number( ) method
      8     */
      9  begin
    10     return to_number(aiv_number);
    11     exception
    12     when INVALID_NUMBER then
    13      return NULL;
    14     when OTHERS then
    15      return null;
    16     end to_number_or_null;
    17  /
    Function created.
    SQL> select to_number_or_null(‘A’) from dual;
    TO_NUMBER_OR_NULL(‘A’)
    ———————-With kind regards
    Krystian Zieja

  • Error Description:TransformCopy ‘DTSTransformation__57’ conversion error

    We are getting error in Interphase while data moving from SAP to Plexus Interphase
    Error Source: Microsoft Data Transformation Services (DTS) Data Pump
    Error Description:TransformCopy ‘DTSTransformation__57’ conversion error: Conversion invalid for datatypes on column pair 1 (source column ‘Col057’ (DBTYPE_STR), destination column ‘reissue_no’ (DBTYPE_I4)).
    Error Help File:sqldts80.hlp
    Error Help Context ID:30501
    1002049940|AB-24966-001|AB-24966-001|8DVAH||OPEN|5013040-K Welcher OHWQM|Q09V36-07 3Q07BB ATM REMOVAL WNI SERVICE ONLY FOR HOU1B12 Vantage01 BSC 01Network Integration Perform pre-checks on the system and ISSHO files run files and support Sprint drive team in test per ND Houston01RG ND25 ME4 Draft062907. WNI hrs 50|||0000641242|Nextel Systems Corp|||||H003XW001|15413 Vantage pkwy|||HOUSTON|TX|77032|US||||||15413 Vantage pkwy|||HOUSTON|TX|77032|US||||||||||6500 Sprint Parkway|||Overland Park|KS|66251-6108|US|Sevice_NI|0006750279||B200707139.0|01/09/2009||||||HSTPTXPR00W|H003XW001||||||04/06/2009||04/24/2009||||||04/24/2009|||||||||||07/10/2007|||||||||||||||||||0524334||||||||||||||01/09/2009||||||||AB-24966-001|||
    We are not able to under stand the error relates . Please helpme with your suggestions.
    Thanks
    Hemanth

    hi
    its due to the converion of datatypes between the two system.

  • TS1629 An unknown error occurred (3194) during ios6 update pls help to get it resolved

    An unknown error occurred (3194) during ios6 update pls help to get it resolved

    There is no supported method to downgrade iOS.
    Put the device in DFU mode and restore.  Be aware, ALL iPhones require a valid SIM for activation.  The SIM does not need to be for an active account, but it must be a SIM from the carrier the device is locked to.

  • LONG RAW — Conversion Error

    Hi,
    We are having a d/b with oracle 7.0 having a column LONG RAW. Client Signatures are stored in the form of Tiff in this column. We are now trying to extract the same and write it in the file system of a different server.
    We are encountering a peculiar problem. For certain cases the conversion and writing part goes of smoothly, but for some cases we are getting an ORACLE error ORA-1460 conversion error while using UTL_RAW.CAST_TO_VARCHAR2 .
    This does not happen for all cases, please help us solve the same

    Hi,
    We are having a d/b with oracle 7.0 having a column LONG RAW. Client Signatures are stored in the form of Tiff in this column. We are now trying to extract the same and write it in the file system of a different server.
    We are encountering a peculiar problem. For certain cases the conversion and writing part goes of smoothly, but for some cases we are getting an ORACLE error ORA-1460 conversion error while using UTL_RAW.CAST_TO_VARCHAR2 .
    This does not happen for all cases, please help us solve the same

  • Runtime error in J2IUN —  «DYNPRO_FIELD_CONVERSION» / «Conversion Error*»

    Hi All,
    I am facing run time error problem during Transaction J2IUN «DYNPRO_FIELD_CONVERSION» / «Conversion Error»
    Error analysis:
    The program has been interrupted and cannot resume.
    Program «J_1IRUTZN» attempted to display fields on screen 9000.
    An error occurred during the conversion of this data.
    There was a conversion error in the output of fields to the screen.
    The formats of the ABAP output field and the screen field may not match.
    Some field types require more space on the screen than in the ABAP
    program. For example, a date output field on the screen requires two
    more characters than the corresponding field in the ABAP program. When
    the date is displayed on the screen, an error occurs resulting in this
    error message.
    Screen name………….. «J_1IRUTZN»
    Screen number………… 9000
    Screen field…………. «UTIL1-REM_BAL»
    Error text…………… «FX015: Sign lost.»
    Other data:
    Kindly guide me to resolve the issue.
    Regards,
    P.S.Chitra

    Hi,
    Here comes the solution…
    Please implemet the SAP note 1252418…
    Looking very much relavent to your problem…
    Regs,
    Lokesh.

  • Error in Dictionary DC deployment (URGENT Pls help)

    Hi experts,
    I am getting following error while deploying the Dictionary DC.
    I made changes in one database table (changing field length, added new columns).
    It got builtr successfully but deployment is giving errror, hence aborted.
    This is the trace m getting:-
    Pls pls help as soon as possible…
    May 5, 2008 4:38:28 PM Info: Starting: Update: Selected development component ‘BshopDic’/’asianpaints.com’/’J2E_BODYSHOP_D’/’20080505171925’ updates currently deployed development component ‘BshopDic’/’asianpaints.com’/’J2E_BODYSHOP_D’/’20080505170547’.
    May 5, 2008 4:38:40 PM Info: <!LOGHEADERSTART/>
    May 5, 2008 4:38:40 PM Info: <!HELPManual modification of the header may cause parsing problem!/>
    May 5, 2008 4:38:40 PM Info: <!LOGGINGVERSIONhttp://1.5.3.7186 — 630/>
    May 5, 2008 4:38:40 PM Info: <!NAME[/usr/sap/J2E/JC00/SDM/program/log/jddilog20080505163828.log]/>
    May 5, 2008 4:38:40 PM Info: <!PATTERNhttp://jddilog20080505163828.log/>
    May 5, 2008 4:38:40 PM Info: <!FORMATTERhttp://com.sap.dictionary.database.dbs.DbTraceFormatter(%s %m %-30l %24d)/>
    May 5, 2008 4:38:40 PM Info: <!ENCODINGISO8859_1/>
    May 5, 2008 4:38:40 PM Info: <!LOGHEADEREND/>
    May 5, 2008 4:38:40 PM Info: 16:38:28 2008-05-05 dbs-Info: <<<<<<<<<<<<<< Table Deployment >>>>>>>>>>>>>
    May 5, 2008 4:38:40 PM Info: 16:38:28 2008-05-05 dbs-Info:
    May 5, 2008 4:38:40 PM Info: 16:38:29 2008-05-05 dbs-Info: <<< Analyze table BC_DDDBRTH >>>
    May 5, 2008 4:38:40 PM Info: 16:38:29 2008-05-05 dbs-Info: predefined action is: >>>null<<<
    May 5, 2008 4:38:40 PM Info: 16:38:29 2008-05-05 dbs-Info: No action required for table
    May 5, 2008 4:38:40 PM Info: 16:38:29 2008-05-05 dbs-Info: <<< Analyze table BC_DDDBTABLERT >>>
    May 5, 2008 4:38:40 PM Info: 1
    6:38:29 2008-05-05 dbs-Info: predefined action is: >>>null<<<
    May 5, 2008 4:38:40 PM Info: 16:38:29 2008-05-05 dbs-Info: No action required for table
    May 5, 2008 4:38:40 PM Info: 16:38:29 2008-05-05 dbs-Info: <<< Analyze table BC_DDDBRTH >>>
    May 5, 2008 4:38:40 PM Info: 16:38:29 2008-05-05 dbs-Info: predefined action is: >>>null<<<
    May 5, 2008 4:38:40 PM Info: 16:38:29 2008-05-05 dbs-Info: No action required for table
    May 5, 2008 4:38:40 PM Info: 16:38:29 2008-05-05 dbs-Info: <<< Analyze table BC_DDDBRTX >>>
    May 5, 2008 4:38:40 PM Info: 16:38:29 2008-05-05 dbs-Info: predefined action is: >>>null<<<
    May 5, 2008 4:38:40 PM Info: 16:38:29 2008-05-05 dbs-Info: No action required for table
    May 5, 2008 4:38:40 PM Info: 16:38:29 2008-05-05 dbs-Info: >>> Analyze tables from archive in database ORACLE
    May 5, 2008 4:38:40 PM Info: 16:38:29 2008-05-05 dbs-Info: Next archive object : dbtables/BIT_AUTONUMBER.gdbtable
    May 5, 2008 4:38:40 PM Info: 16:38:29 2008-05-05 dbs-Info: <<< Analyze table BIT_AUTONUMBER >>>
    May 5, 2008 4:38:40 PM Info: 16:38:29 2008-05-05 dbs-Info: predefined action is: >>>null<<<
    May 5, 2008 4:38:40 PM Info: 16:38:29 2008-05-05 dbs-Info: Action: CONVERT
    May 5, 2008 4:38:40 PM Info: 16:38:29 2008-05-05 dbs-Info: Table has to be converted
    May 5, 2008 4:38:40 PM Info:
    May 5, 2008 4:38:40 PM Info: E R R O R ******* (DbModificationManager)
    May 5, 2008 4:38:40 PM Info: 16:38:29 2008-05-05 dbs-Error: Table BIT_AUTONUMBER: Conversion currently not possible
    May 5, 2008 4:38:40 PM Info:
    May 5, 2008 4:38:40 PM Info: E R R O R ******* (DbModificationManager)
    May 5, 2008 4:38:40 PM Info: 16:38:29 2008-05-05 dbs-Error: Table BIT_AUTONUMBER: Conversion currently not possible
    May 5, 2008 4:38:40 PM Info: 16:38:29 2008-05-05 dbs-Info: Next archive object : dbtables/BIT_BRAND.gdbtable

    Hi,
    It looks like the conversion of datatype is making issues.
    Either existing values are not complaint with the size changes you made.
    To resolve this either you remove the existing records and deploy.
    Take a backup of records and reimport later with default values to the newly added cols if they are not null.
    Regards
    Ayyapparaj

  • Not well-formed error in firefox in implementing ajax—pls help

    hi techies,
    I’m trying to implement ajax in firefox and i’m getting not well-formed error in error console
    heres part of code
    var xmlHttp;
    function create(){
    if(window.ActiveXObject){
    xmlHttp=window.ActiveXObject(«Microsoft.XMLHTTP»);
    else if(window.XMLHttpRequest){
    xmlHttp=window.XMLHttpRequest();
    else{
    xmlHttp=new ActiveXObject(«Msxml2.XMLHTTP»);
    function getEmployeeDetails(){
    frm = document.forms[0];
    empid = frm.elements[«empid»].value;
    url=»empdetails.jsp?empid=» + empid;
    xmlHttp.open(«GET» ,url, true);
    xmlHttp.onreadystatechange=doUpdate;
    xmlHttp.send(null);
    function doUpdate(){
    if(xmlHttp.readyState==4 && xmlHttp.status == 200){
    var root = xmlHttp.responseXML.documentElement;
    —-so on
    jsp Page is
    <%@ page import=»java.sql.*» contentType=»text/xml» %>
    <%
    String empid=request.getParameter(«empid»);
    Class.forName(«oracle.jdbc.driver.OracleDriver»);
    Connection con=DriverManager.getConnection(«jdbc:odbc:vmouli»,»hr»,»hr»);
    Statement st=con.createStatement();
    ResultSet rs=st.executeQuery(«select first_name,salary from employees where employee_id=» + empid);
    if(rs.next()){
    out.println(«<employee><name>»);out.println(rs.getString(1));
    out.println(«</name><salary>»);out.println(rs.getString(2));
    out.println(«</salary></employee>»);
    else{
    out.println(«<error>Employee ID not found</error>»);
    rs.close();
    st.close();
    con.close();
    %>
    Firefox error console is saying not well-formed and is pointing to starting of my jsp page
    can anyone help plzzz

    As BalusC said — run the JSP producing the xml.
    Save that xml to a file — INCLUDING any white space — because thats what you actually get.
    Open that xml file in your browser — it should tell you at that point if your xml is well formed.
    AS BalusC said this is better done in a servlet — especially since you’re just doing out.println.
    JSPs add extra whitespace and carriage returns. While that won’t necessarily break XML, it can cause problems with the first few characters.

  • Error while using Javamail…pls help me…

    when i am using javamail for sending mail , i am getting error like,
    C:jdk1.3binmail>java MailSend
    [email protected] [email protected]
    javax.mail.SendFailedException: Sending failed;
    nested exception is:
    javax.mail.MessagingException:
    at javax.mail.Transport.send0(Transport.java:218)
    at javax.mail.Transport.send(Transport.java:80)
    at MailSend.Send(MailSend.java:56)
    at MailSend.main(MailSend.java:73)
    and i define properties like,
    mailProp.put(«java», «java»);
    where , «java» is my system name, and there is also mail server on my system. and my system is connected with proxy server..
    when i am trying
    mailProp.put(«mail.smtp.host», «java»);
    then i am getting same type of error…
    so, what is that ? pls help me to solve my error…

    Surely there’s more information associated with that MessaginException than
    you’ve included here.
    Turn on session debugging and run your program again.
    http://java.sun.com/products/javamail/FAQ.html#debug

  • ORA-06502 PL/SQLnumeric or value error character to number conversion error

    Hi,
    I have written report in FastReport and I am using «Oracle Provider for OLE DB» for Oracle connection.
    I have seen that my report throws oracle exception in some machines , so I analysed my PL/SQL and saw that problem occurs in «TO_NUMBER» function. (if i remove it exception does not occur)
    However, same report works fine in another machine with the same data (same oracle provider version).
    What can be the problem? What can be the dependence?
    Thanks in advance
    Elshan
    p.s. Oracle provider version is 11.2.0.2.0

    Hi ,
    the reason you are gettin this error is ecause sometimes in your data you are trying to convert a character to a number. When you say it works fine in other machine dos it mean for the same data set or a different data?
    If you thing that you data may conatin a character and you still need to use TO_NUMBer than you should chack the data before converting and if it is a character than you should no do the conversion.
    you can use this link to chek numeris or non numeric
    How to check if a field is numeric?
    thanks
    Edited by: Himanshu Kandpal on Mar 31, 2011 7:55 AM

  • Error on class attribute… pls. help!

    hi! i am beginning to learn jsp. i am using tomcat 5.5.20 and using some url i am learning over time bout jsp… only this, im having a very hard time figuring out the error i am getting.
    HTTP Status 500 —
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: /SaveName.jsp(1,1) The value for the useBean class attribute user.UserData is invalid.
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:512)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    org.apache.jasper.JasperException: /SaveName.jsp(1,1) The value for the useBean class attribute user.UserData is invalid.
    org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
         org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405)
         org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:146)
         org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1174)
         org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1116)
         org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
         org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
         org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219)
         org.apache.jasper.compiler.Node$Root.accept(Node.java:456)
         org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
         org.apache.jasper.compiler.Generator.generate(Generator.java:3320)
         org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:198)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:305)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.5.20 logs.
    i already compiled my UserData.java and stored the UserData.class in webapps/app-root/WEB-INF/classes and i already set my classpath also. here’s my files:
    GetName.html
    <HTML>
    <BODY>
    <FORM METHOD=POST ACTION=»SaveName.jsp»>
    What’s your name? <INPUT TYPE=TEXT NAME=username SIZE=20><BR>
    What’s your e-mail address? <INPUT TYPE=TEXT NAME=email SIZE=20><BR>
    What’s your age? <INPUT TYPE=TEXT NAME=age SIZE=4>
    <P><INPUT TYPE=SUBMIT>
    </FORM>
    </BODY>
    </HTML>
    SaveName.jsp
    <jsp:useBean id=»user» class=»user.UserData» scope=»session»/>
    <jsp:setProperty name=»user» property=»*»/>
    <HTML>
    <BODY>
    Continue
    </BODY>
    </HTML>
    NextPage.jsp
    <jsp:useBean id=»user» class=»user.UserData» scope=»session»/>
    <HTML>
    <BODY>
    You entered<BR>
    Name: <%= user.getUsername() %><BR>
    Email: <%= user.getEmail() %><BR>
    Age: <%= user.getAge() %><BR>
    </BODY>
    </HTML>
    pls. kindly help me with this… thanks a lot!!!

    hello
    check ur bean naem. Every thing is fine but see the msg below.The attribute of the bean is invalid.
    /SaveName.jsp(1,1) The value for the useBean class attribute user.UserData is invalid.
    just check it again. or remove bean class and simple take the first html files parameter with
    String name=request.getParameter(«user»)
    String mail=request.getParameter(«emailr»)
    then print the name and mail varibale with jsp Expression
    then u will come to know .
    and then try with bean
    try it
    bye

Maybe you are looking for

  • MRP storage location

    to check for all materials in a given plant if ‘Storage location MRP’ details is maintained or not in MRP-4 view of material master.

  • Clearance Charges in MIRO

    For Import PO scenario, I am posting two invoices for Clearance Charges for the same Vendor (only one condition maintained in PO for clearance charges). E.g rs 2000 clearance charges for 100 qty (in PO) I am posting first invoice of rs 1500 for 100 q

  • Position of an non modal external window

    How is it possible to set the position of an non modal external window? I’ve tried it over window.setWindowPosition(new WDCssSize(500,WDWindowUnitOfLength.PX),new WDCssSize(200, WDWindowUnitOfLength.PX)); and also over window.setWindowPosition(500,20

  • Error OALL8 is in an inconsistent state

    Hi, we have a Problem with Oracle 10.2.0.4. Error OALL8 is in an inconsistent state! Have someone heared about this error? With Goggle, i can´t find helpfull sides :( we have 2 Clients with this massege. Thanks at all

  • Student Information System

    Hello, I am wondering if i would be able to use sharepoint as a student information system or if theres away i can use my access student information system for access with sharepoint?

Проблема в том, что ваш второй оператор RETURN возвращает VARCHAR2, в то время как ваша функция объявлена ​​возвращающей RAW. Вы можете исправить это, вызвав UTL_RAW.CAST_TO_RAW, т.е.

   EXCEPTION
      WHEN OTHERS THEN
         service_func.log_error(p_title_package_name || '.' || 
                                   p_title_procedure_name, 
                                'Proc', 
                                NULL, 
                                SYSDATE, 
                                SQLERRM, 
                                p_in || '~' || p_key);
         RETURN utl_raw.cast_to_raw( 'Encryption_ERROR' );
   END;

Если я объявлю две функции, одну, которая возвращает жестко закодированную строку, и другую, которая возвращает RAW, вы увидите разницу (я удаляю вызовы DBMS_CRYPTO и вызов LOG_ERROR). Если я объявлю функцию, которая возвращает RAW, вы получите результат обратно (хотя человеку придется преобразовать необработанные данные обратно в строку, чтобы понять результат)

SQL> ed
Wrote file afiedt.buf

  1  create or replace function throw_exception
  2    return raw
  3  is
  4    my_exception exception;
  5  begin
  6    raise my_exception;
  7  exception
  8    when others then
  9      return utl_raw.cast_to_raw( 'Foo' );
 10* end;
SQL> /

Function created.

SQL> select throw_exception
  2    from dual;

THROW_EXCEPTION
-----------------------------------------------------------------------------

466F6F

Если я просто верну строку, я получу то же исключение, что и вы.

SQL> ed
Wrote file afiedt.buf

  1  create or replace function throw_exception2
  2    return raw
  3  is
  4    my_exception exception;
  5  begin
  6    raise my_exception;
  7  exception
  8    when others then
  9      return 'Foo';
 10* end;
SQL> /

Function created.

SQL> select throw_exception2
  2    from dual;
select throw_exception2
       *
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: hex to raw conversion error
ORA-06512: at "SCOTT.THROW_EXCEPTION2", line 9
ORA-06510: PL/SQL: unhandled user-defined exception

Конечно, другим вариантом было бы объявить, что функция возвращает VARCHAR2. Но я бы предпочел иметь хэши и зашифрованные данные в RAW, а не в VARCHAR2, чтобы вам никогда не приходилось беспокоиться о таких вещах, как проблемы преобразования набора символов, искажающие данные.

IS it useful?????

Overview
———

This article contains a fairly advanced sample which demonstrates how to
insert and select data from a LONG RAW column using PL/SQL.

Caution
——-

The sample program in this article is provided for educational purposes only
and is NOT supported by Oracle Support Services. It has been tested
internally, however, and works as documented. We do not guarantee that it
will work for you, so be sure to test it in your environment before relying
on it.

Program
——-

— Table required by the testrawio package

CREATE TABLE testraw (col1 NUMBER, col2 LONG RAW);
/

CREATE OR REPLACE PACKAGE testrawio AS

— Accepts a character string, places it into a
— long raw variable, inserts it into the db,
— selects it out of the db, converts the result
— back into a character string

PROCEDURE testrawio(rawparam in out varchar2);

— Offers conversions raw and char formats

FUNCTION chartoraw(v_char varchar2) return long raw;
FUNCTION rawtochar(v_raw long raw) return varchar2;

— Offers conversions between decimal and hex format

FUNCTION numtohex(v_hex number) return varchar2;
FUNCTION hextonum(v_hex varchar2) return number;

END;
/

CREATE OR REPLACE PACKAGE BODY testrawio
as

PROCEDURE testrawio(rawparam in out varchar2)
is
rawdata long raw;
rawlen number;
outlen number;
hex varchar2(32760);
i number;
begin
dbms_output.put_line(‘Value In :’ ||rawparam);

— Get the length of the variable and convert it to a long raw

rawlen := length(rawparam);
rawdata := chartoraw(rawparam);

INSERT INTO testraw VALUES (rawlen, rawdata);
COMMIT;
SELECT col1, col2 INTO outlen, rawdata FROM testraw;

— Reset varaiable to nothing and buffer the converted long raw in it

rawparam := »;
rawparam := rawtochar(rawdata);

dbms_output.put_line(‘Value Out:’ ||rawparam);
if outlen = length(rawparam) then
dbms_output.put_line(‘All bytes retrieved’);
else
dbms_output.put_line(‘Checksum failed’);
end if;
end;

FUNCTION chartoraw(v_char varchar2) return long raw
is
rawdata long raw;
rawlen number;
hex varchar2(32760);
i number;
begin
rawlen := length(v_char);
i := 1;
while i <= rawlen
loop
hex := numtohex(ascii(substrb(v_char,i,1)));
rawdata := rawdata || HEXTORAW(hex);
i := i + 1;
end loop;

return rawdata;
end;

FUNCTION rawtochar(v_raw long raw) return varchar2
is
rawlen number;
hex varchar2(32760);
rawparam varchar2(32760);
i number;
begin
hex := rawtohex(v_raw);
rawlen := length(hex);
i := 1;
while i <= rawlen
loop
rawparam := rawparam||CHR(HEXTONUM(substrb(hex,i,2)));
i := i + 2;
end loop;

return rawparam;
end;

FUNCTION numtohex(v_hex number) return varchar2
is
hex varchar2(4);
num1 number;
num2 number;
begin
num1 := trunc(v_hex/16);
num2 := v_hex-(num1*16);

if ( num1 >= 0 and num1 <= 9 ) then
hex := hex||to_char(num1);
end if;
if num1 = 10 then hex := hex||’A’; end if;
if num1 = 11 then hex := hex||’B’; end if;
if num1 = 12 then hex := hex||’C’; end if;
if num1 = 13 then hex := hex||’D’; end if;
if num1 = 14 then hex := hex||’E’; end if;
if num1 = 15 then hex := hex||’F’; end if;

if ( num2 >= 0 and num2 <= 9 ) then
hex := hex||to_char(num2);
end if;
if num2 = 10 then hex := hex||’A’; end if;
if num2 = 11 then hex := hex||’B’; end if;
if num2 = 12 then hex := hex||’C’; end if;
if num2 = 13 then hex := hex||’D’; end if;
if num2 = 14 then hex := hex||’E’; end if;
if num2 = 15 then hex := hex||’F’; end if;

return hex;
end;

FUNCTION hextonum(v_hex varchar2) return number
is
hex varchar2(4);
num number;
num1 number;
num2 number;
begin
hex := substrb(v_hex,1,1);

if ( hex >= ‘0’ and hex <= ‘9’ ) then
num1 := to_number(hex);
end if;
if hex = ‘A’ then num1 := 10; end if;
if hex = ‘B’ then num1 := 11; end if;
if hex = ‘C’ then num1 := 12; end if;
if hex = ‘D’ then num1 := 13; end if;
if hex = ‘E’ then num1 := 14; end if;
if hex = ‘F’ then num1 := 15; end if;

hex := substrb(v_hex,2,1);

if ( hex >= ‘0’ and hex <= ‘9’ ) then
num2 := to_number(hex);
end if;
if hex = ‘A’ then num2 := 10; end if;
if hex = ‘B’ then num2 := 11; end if;
if hex = ‘C’ then num2 := 12; end if;
if hex = ‘D’ then num2 := 13; end if;
if hex = ‘E’ then num2 := 14; end if;
if hex = ‘F’ then num2 := 15; end if;

num := (num1*16)+num2;
return num;
end;

end;
/

— This is meant to test our newly created
— long raw manipulation package from
— SQL*Plus!

set termout on
set serveroutput on
variable rawparam varchar2(100);
begin
:rawparam := ‘This is a test of an insert and select from a long raw column!’;
end;
/

truncate table testraw;
execute testrawio.testrawio(:rawparam);

Sample Output:

Value In :This is a test of an insert and select from a long raw column!
Value Out:This is a test of an insert and select from a long raw column!
All bytes retrieved

Sam

Понравилась статья? Поделить с друзьями:
  • Pkt loss pubg как исправить
  • Pkgj ps vita ошибка 0x80436007
  • Pkg static repository freebsd load error meta cannot be loaded no error 0
  • Pkcs11 rutoken ошибка 0x7
  • Pkcs11 rutoken ошибка 0x6