Unexpected Result Returned With Using Unit Test For Function. (Doc ID 2029172.1)

Last updated on JULY 28, 2015

Applies to:

Oracle SQL Developer - Version 4.1 and later
Information in this document applies to any platform.

Symptoms

Function gives the wrong result,for example,using the following
script which input value is multi-byte like Japanese,the procedure's
result is expected as 'E38182',
But Function's result is wrong to become C2BF.

-----

CREATE OR REPLACE PACKAGE BODY test06 AS
PROCEDURE test06_main(pi_arg01 IN VARCHAR2, po_status OUT VARCHAR2) IS
typ_data type01;
BEGIN
 typ_data.typ_d1 := pi_arg01;
 po_status := test06_func(typ_data);
END test06_main;

FUNCTION test06_func(fi_arg01 IN type01) RETURN VARCHAR2 IS
li_ret VARCHAR2(20);
moji   RAW(20);
BEGIN
  moji := utl_i18n.string_to_raw( fi_arg01.typ_d1,'UTF8');
  li_ret := rawtohex(moji);
  RETURN  li_ret;
END test06_func;
END test06;

-----

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms