Replace function Issue
Hi All,
I using replace in my package and facing this issue.
In my code i have temp fields 1 to 15.
so when i use replace function to replace :temp1 value it also replaces value of :temp11.
:temp1 = some checks
:temp2 = some checks
:temp9 = some checks
:temp10 = some checks
till temp15
Any Solutions for this?
Thanks.
like for example :
i want to replace the value of temp1 field with 10 and temp10, temp11 ...with some other values.
in code it will
/*temp1*/
if ('10') = some value then
some actions;
end if;
/*temp10*/
if ('10'0) = some value then -- value of temp1 gets replaced here
end if;
Similar Messages
-
Function issue in oracle 8i (817)
Hello,
Following objects are created in database
1. CREATE OR REPLACE TYPE PARAMETER_OBJ AS OBJECT
RUN VARCHAR2(2000),
BATCH_NO VARCHAR2(2000),
DAY_NO VARCHAR2(2000),
PARAMETER_NAME VARCHAR2(2000),
PARAMETER_VALUE VARCHAR2(2000),
PARAMETER_UOM VARCHAR2(2000)
2. CREATE OR REPLACE TYPE PARAMETER_TYP AS TABLE OF PARAMETER_OBJ ;
Info abt the function
1. function return type is PARAMETER_TYP.
2. Inside the function i initialize tblParameters PARAMETER_TYP:=PARAMETER_TYP();
3. Create a temporary table[TMP_PARAMETER] .The structure of the table is same as "PARAMETER_OBJ"
4. In a loop Insert data into temporary table
5. At the end issue following select statement
SELECT CAST (MULTISET (SELECT * FROM TMP_PARAMETER)
AS PARAMETER_TYP )
INTO tblParameters FROM DUAL;
6. issue commit (which flushes temp table)
7. return RETURN tblParameters
Finally issue following sql statement to get data from the function
select * from table(T_Get_ParameterValue('A03052','-1-SPINNER-CELL_AGE-15L,3-SPINNER-DOUBLING_TIME-15L'))
It works oracle 10g. In oracle 817 function compiles.But if i select as shown above it gives erorr says nested table not found..
Can any body help me.1. CREATE OR REPLACE TYPE PARAMETER_OBJ AS OBJECT
RUN VARCHAR2(2000),
BATCH_NO VARCHAR2(2000),
DAY_NO VARCHAR2(2000),
PARAMETER_NAME VARCHAR2(2000),
PARAMETER_VALUE VARCHAR2(2000),
PARAMETER_UOM VARCHAR2(2000)
2. CREATE OR REPLACE TYPE PARAMETER_TYP AS TABLE OF PARAMETER_OBJ ;
# Code
CREATE OR REPLACE Function T_Get_ParameterValue
a_run CLOB,
a_dytblcoleqp CLOB
-- [T]: TO_REMOVE: Changed return type.
-- 1. Need to create a temporary table TMP_PARAMETER which has the same structure as your object.
--RETURN PARAMETER_TYP PIPELINED
RETURN PARAMETER_TYP
AS
PRAGMA AUTONOMOUS_TRANSACTION;
TYPE cursor_type IS REF CURSOR;
TYPE STR_LST IS TABLE OF VARCHAR2(2000) INDEX BY BINARY_INTEGER;
l_sql varchar2(4000);
l_cr cursor_type;
-- [T]: TO_REMOVE: Added variable.
tblParameters PARAMETER_TYP:=PARAMETER_TYP();
l_batch_lst STR_LST;
l_tblcl_lst STR_LST;
l_tbl_lst STR_LST;
l_col_lst STR_LST;
l_day_lst STR_LST;
l_sign_lst STR_LST;
l_eqp_lst STR_LST;
l_con CLOB;
l_tmp varchar2(4000);--Tmp store
l_pos number:=0; -- LOcator of the seperaotr
s_pos number:=0; -- start position
l_k number:=0; -- Array controller
l_n number:=0; -- Array controller
f_sp varchar2(1):=','; -- First seperator
s_sp varchar2(1):='-'; -- Second seperator
l_col_desc varchar2(2000);
l_column_type varchar2(2000);
l_capture_date varchar2(2000);
-- ipc list
l_parameter_uom varchar2(2000);
l_action_limit_max varchar2(2000);
l_action_limit_min varchar2(2000);
l_control_limit_max varchar2(2000);
l_control_limit_min varchar2(2000);
l_center_line varchar2(2000);
l_parameter_value varchar2(2000);
l_batch_id varchar2(2000);
l_batch_no varchar2(2000);
l_day_no varchar2(2000);
l_eqp varchar2(2000);
l_date date;
-- Loop Control
l_cont number;
i number;
--remove
l_sqlerm varchar2(2000);
BEGIN
l_pos:=0; -- LOcator of the seperaotr
-- Parsing
-- Parsing the tbl and col list
s_pos:=1;
l_cont:=1; -- loop control
i:=0; -- loop control
while (l_cont=1) loop
i:=i+1;
l_k:=l_k+1;
--determine position
l_pos:=instr(a_dytblcoleqp,f_sp,1,i);
if l_pos=0 and i=1 then -- no need to parse ,only 1 record
l_tmp:=a_dytblcoleqp;
l_tblcl_lst(l_k):=l_tmp;
--exit;
l_cont:=0;
elsif l_pos=0 and i!=1 then
l_tmp:=substr(a_dytblcoleqp,s_pos);
l_tblcl_lst(l_k):=l_tmp;
l_k:=l_k-1; re caluclate. nothing else to parse
--exit;
l_cont:=0;
else -- continue parse
l_tmp:=substr(a_dytblcoleqp,s_pos,l_pos-s_pos);
l_tblcl_lst(l_k):=l_tmp;
s_pos:=l_pos+1;
end if;
end loop; -- end of while loop
for j in 1..l_k loop
-- validate sign
if substr(l_tblcl_lst(j),1,1)='-' then
l_tblcl_lst(j):=substr(l_tblcl_lst(j),2);
l_sign_lst(j):='-';
else
l_sign_lst(j):='';
end if;
l_day_lst(j):=substr(l_tblcl_lst(j),1,instr(l_tblcl_lst(j),s_sp,1,1)-1);
l_day_lst(j):=l_sign_lst(j)||l_day_lst(j);
l_tbl_lst(j):=substr(l_tblcl_lst(j),instr(l_tblcl_lst(j),s_sp,1,1)+1,instr(l_tblcl_lst(j),s_sp,1,2)-instr(l_tblcl_lst(j),s_sp,1,1)-1);
l_col_lst(j):=substr(l_tblcl_lst(j),instr(l_tblcl_lst(j),s_sp,1,2)+1,instr(l_tblcl_lst(j),s_sp,1,3)-instr(l_tblcl_lst(j),s_sp,1,2)-1);
l_eqp_lst(j):=substr(l_tblcl_lst(j),(instr(l_tblcl_lst(j),s_sp,1,3)+1));
end loop;
-- Parsing Batch List
s_pos:=1;
l_cont:=1; -- loop control
i:=0; -- loop control
while (l_cont=1) loop
i:=i+1;
l_n:=l_n+1;
--determine position
l_pos:=instr(a_run,f_sp,1,i);
if l_pos=0 and i=1 then -- no need to parse ,only 1 record
l_tmp:=a_run;
l_batch_lst(l_n):=l_tmp;
l_cont:=0;--exit while loop
elsif l_pos=0 and i!=1 then
l_tmp:=substr(a_run,s_pos);
l_batch_lst(l_n):=l_tmp;
l_cont:=0;--exit while loop
else -- continue parse
l_tmp:=substr(a_run,s_pos,l_pos-s_pos);
l_batch_lst(l_n):=l_tmp;
s_pos:=l_pos+1;
end if;
end loop;
--- end of Parsing
-- Build con catenate list
for k in 1..l_n loop
--l_con:=NULL;
--l_con:='(';
--l_con:=l_con||''''||l_batch_lst(k)||''')';
--dbms_output.put_line(l_con);
for j in 1..l_k loop
-- 1 -- Get col desc
begin
select COLUMN_DESCR,COLUMN_TYPE,CAPTURE_DATE
into l_col_desc,l_column_type,l_capture_date
from MDM_ALL_PARAMETER_LIST
where table_name=upper(l_tbl_lst(j))
and column_name=upper(l_col_lst(j));
exception
when others then
l_col_desc:=NULL;
l_column_type:=NULL;
l_capture_date:=NULL;
end;
--dbms_output.put_line(l_batch_lst(k)||'-'||l_tbl_lst(j)||'-'||l_col_lst(j)||'-'||l_col_desc||'-'||to_char(l_capture_date));
--Build Sql Statement
if l_tbl_lst(j)='THAW' then
l_sql:=NULL;
l_sql:='select distinct spinner.BATCH_ID as batch_id,thaw.BIN_NO as bin_no,ipc.DAY_NO as day_no,NULL as eqp,ipc.PARAMETER_UOM as parameter_uom ,ipc.IPC_ACTION_LIMIT_MAX as ipc_action_limit_max,ipc.IPC_ACTION_LIMIT_MIN as ipc_action_limit_min,ipc.IPC_CONTROL_LIMIT_MAX as ipc_control_limit_max,ipc.IPC_CONTROL_LIMIT_MIN as ipc_control_limit_min,ipc.CENTER_LINE as center_line,thaw.'||l_col_lst(j)||','||l_capture_date;
l_sql:=l_sql||' from SPINNER spinner, BIN_HIER bin_hier, THAW thaw,IPC_LIMITS ipc';
l_sql:=l_sql||' where spinner.bin_no = bin_hier.bin_no';
l_sql:=l_sql||' and bin_hier.PROCESS_STEP =30';
l_sql:=l_sql||' and bin_hier.Revival_no = thaw.Revival_no';
l_sql:=l_sql||' and spinner.bin_no=ipc.LOT(+)';
l_sql:=l_sql||' and spinner.BATCH_ID=ipc.BATCH_ID(+)';
l_sql:=l_sql||' and spinner.BATCH_ID=:1';
l_sql:=l_sql||' and ipc.TABLE_NAME(+)=:2';
l_sql:=l_sql||' and ipc.COLUMN_NAME(+)=:3';
l_sql:=l_sql||' and ipc.SITE_ID(+)=:4';
--dbms_output.put_line(l_sql);
elsif l_tbl_lst(j)='THAW_SAMPLES' then
if l_col_lst(j)!='CALC' then
l_sql:=NULL;
l_sql:='select distinct spinner.BATCH_ID as batch_id,thaw_samples.BIN_NO as bin_no,thaw_samples.DAY_NO as day_no,NULL as eqp,ipc.PARAMETER_UOM as parameter_uom ,ipc.IPC_ACTION_LIMIT_MAX as ipc_action_limit_max,ipc.IPC_ACTION_LIMIT_MIN as ipc_action_limit_min,ipc.IPC_CONTROL_LIMIT_MAX as ipc_control_limit_max,ipc.IPC_CONTROL_LIMIT_MIN as ipc_control_limit_min,ipc.CENTER_LINE as center_line,thaw_samples.'||l_col_lst(j)||',thaw_samples.'||l_capture_date;
else
l_sql:=NULL;
--l_sql:='select spinner.BATCH_ID as batch_id,thaw_samples.BIN_NO as bin_no,thaw_samples.DAY_NO as day_no,NULL as eqp,ipc.PARAMETER_UOM as parameter_uom ,ipc.IPC_ACTION_LIMIT_MAX as ipc_action_limit_max,ipc.IPC_ACTION_LIMIT_MIN as ipc_action_limit_min,ipc.IPC_CONTROL_LIMIT_MAX as ipc_control_limit_max,ipc.IPC_CONTROL_LIMIT_MIN as ipc_control_limit_min,ipc.CENTER_LINE as center_line,null as Parameter_value,thaw_samples.'||l_capture_date;
l_sql:='select distinct spinner.BATCH_ID as batch_id,thaw_samples.BIN_NO as bin_no,thaw_samples.DAY_NO as day_no,NULL as eqp,ipc.PARAMETER_UOM as parameter_uom ,ipc.IPC_ACTION_LIMIT_MAX as ipc_action_limit_max,ipc.IPC_ACTION_LIMIT_MIN as ipc_action_limit_min,ipc.IPC_CONTROL_LIMIT_MAX as ipc_control_limit_max,ipc.IPC_CONTROL_LIMIT_MIN as ipc_control_limit_min,ipc.CENTER_LINE as center_line,Get_IPC_Parameter_Value('''||l_tbl_lst(j)||''''||','||''''||l_col_lst(j)||''',spinner.BATCH_ID,thaw_samples.BIN_NO,thaw_samples.DAY_NO),thaw_samples.'||l_capture_date;
end if;
l_sql:=l_sql||' from SPINNER spinner, BIN_HIER bin_hier, THAW thaw,THAW_SAMPLES thaw_samples,IPC_LIMITS ipc';
l_sql:=l_sql||' where spinner.bin_no = bin_hier.bin_no';
l_sql:=l_sql||' and bin_hier.PROCESS_STEP =30';
l_sql:=l_sql||' and bin_hier.Revival_no = thaw.Revival_no';
l_sql:=l_sql||' and thaw_samples.bin_no=thaw.bin_no';
l_sql:=l_sql||' and spinner.bin_no=ipc.LOT(+)';
l_sql:=l_sql||' and spinner.BATCH_ID=ipc.BATCH_ID(+)';
l_sql:=l_sql||' and spinner.BATCH_ID=:1';
l_sql:=l_sql||' and ipc.TABLE_NAME(+)=:2';
l_sql:=l_sql||' and ipc.COLUMN_NAME(+)=:3';
l_sql:=l_sql||' and ipc.SITE_ID(+)=:4';
l_sql:=l_sql||' and ipc.day_no(+)=:5';
l_sql:=l_sql||' and thaw_samples.day_no=:6';
elsif l_tbl_lst(j) in ('F1250L_TEST','F200L_TEST','F4000L_TEST','F8000L_TEST') then
l_sql:=NULL;
l_sql:='select t.batch_id,t.bin_no,t.DAY_NO as day_no,NULL as eqp,ipc.PARAMETER_UOM as parameter_uom ,ipc.IPC_ACTION_LIMIT_MAX as ipc_action_limit_max,ipc.IPC_ACTION_LIMIT_MIN as ipc_action_limit_min,ipc.IPC_CONTROL_LIMIT_MAX as ipc_control_limit_max,ipc.IPC_CONTROL_LIMIT_MIN as ipc_control_limit_min,ipc.CENTER_LINE as center_line,t.'|| l_col_lst(j)||',t.'||l_capture_date;
l_sql:=l_sql||' from '||l_tbl_lst(j)||' t,IPC_LIMITS ipc ';
l_sql:=l_sql||' where 1=1';
l_sql:=l_sql||' and t.BATCH_ID=ipc.BATCH_ID(+)';
l_sql:=l_sql||' and t.BIN_NO=ipc.LOT(+)';
l_sql:=l_sql||' and t.day_no=ipc.day_no(+)';
l_sql:=l_sql||' and t.batch_id=:1';
l_sql:=l_sql||' and ipc.TABLE_NAME(+)=:2';
l_sql:=l_sql||' and ipc.COLUMN_NAME(+)=:3';
l_sql:=l_sql||' and ipc.SITE_ID(+)=:4';
l_sql:=l_sql||' and t.day_no=:5';
elsif l_tbl_lst(j) in ('SPINNER_SAMPLES') then
l_sql:=NULL;
l_sql:='select smp.batch_id,smp.bin_no,smp.DAY_NO as day_no,spn.src_vessel_id as eqp,ipc.PARAMETER_UOM as parameter_uom ,ipc.IPC_ACTION_LIMIT_MAX as ipc_action_limit_max,ipc.IPC_ACTION_LIMIT_MIN as ipc_action_limit_min,ipc.IPC_CONTROL_LIMIT_MAX as ipc_control_limit_max,ipc.IPC_CONTROL_LIMIT_MIN as ipc_control_limit_min,ipc.CENTER_LINE as center_line,smp.'|| l_col_lst(j)||',smp.'||l_capture_date;
l_sql:=l_sql||' from SPINNER spn , SPINNER_SAMPLES smp,IPC_LIMITS ipc ';
l_sql:=l_sql||' where 1=1';
l_sql:=l_sql||' and spn.bin_no=smp.bin_no';
l_sql:=l_sql||' and smp.BATCH_ID=ipc.BATCH_ID(+)';
l_sql:=l_sql||' and smp.DAY_NO=ipc.DAY_NO(+)';
l_sql:=l_sql||' and smp.BIN_NO=ipc.LOT(+)';
l_sql:=l_sql||' and smp.batch_id=:1';
l_sql:=l_sql||' and ipc.TABLE_NAME(+)=:2';
l_sql:=l_sql||' and ipc.COLUMN_NAME(+)=:3';
l_sql:=l_sql||' and ipc.SITE_ID(+)=:4';
l_sql:=l_sql||' and smp.DAY_NO(+)=:5';
l_sql:=l_sql||' and upper(trim(replace(spn.src_vessel_id,'' '')))=:6';
elsif l_tbl_lst(j) in ('SPINNER') then
l_sql:=NULL;
l_sql:='select t.batch_id,t.bin_no,null as day_no,t.src_vessel_id as eqp,ipc.PARAMETER_UOM as parameter_uom ,ipc.IPC_ACTION_LIMIT_MAX as ipc_action_limit_max,ipc.IPC_ACTION_LIMIT_MIN as ipc_action_limit_min,ipc.IPC_CONTROL_LIMIT_MAX as ipc_control_limit_max,ipc.IPC_CONTROL_LIMIT_MIN as ipc_control_limit_min,ipc.CENTER_LINE as center_line,t.'|| l_col_lst(j)||',t.'||l_capture_date;
l_sql:=l_sql||' from '||l_tbl_lst(j)||' t,IPC_LIMITS ipc ';
l_sql:=l_sql||' where 1=1';
l_sql:=l_sql||' and t.BATCH_ID=ipc.BATCH_ID(+)';
l_sql:=l_sql||' and t.BIN_NO=ipc.LOT(+)';
l_sql:=l_sql||' and t.batch_id=:1';
l_sql:=l_sql||' and ipc.TABLE_NAME(+)=:2';
l_sql:=l_sql||' and ipc.COLUMN_NAME(+)=:3';
l_sql:=l_sql||' and ipc.SITE_ID(+)=:4';
l_sql:=l_sql||' and upper(trim(replace(t.src_vessel_id,'' '')))=:5';
else
-- rest
l_sql:=NULL;
l_sql:='select t.batch_id,t.bin_no,ipc.DAY_NO as day_no,NULL as eqp,ipc.PARAMETER_UOM as parameter_uom ,ipc.IPC_ACTION_LIMIT_MAX as ipc_action_limit_max,ipc.IPC_ACTION_LIMIT_MIN as ipc_action_limit_min,ipc.IPC_CONTROL_LIMIT_MAX as ipc_control_limit_max,ipc.IPC_CONTROL_LIMIT_MIN as ipc_control_limit_min,ipc.CENTER_LINE as center_line,t.'|| l_col_lst(j)||',t.'||l_capture_date;
l_sql:=l_sql||' from '||l_tbl_lst(j)||' t,IPC_LIMITS ipc ';
l_sql:=l_sql||' where 1=1';
l_sql:=l_sql||' and t.BATCH_ID=ipc.BATCH_ID(+)';
l_sql:=l_sql||' and t.BIN_NO=ipc.LOT(+)';
l_sql:=l_sql||' and t.batch_id=:1';
l_sql:=l_sql||' and ipc.TABLE_NAME(+)=:2';
l_sql:=l_sql||' and ipc.COLUMN_NAME(+)=:3';
l_sql:=l_sql||' and ipc.SITE_ID(+)=:4';
end if;
-- Open the cursor and filled up object
if l_tbl_lst(j)='THAW_SAMPLES' then
open l_cr for l_sql using l_batch_lst(k),l_tbl_lst(j),l_col_lst(j),1,l_day_lst(j),l_day_lst(j);
loop
null;
fetch l_cr into l_batch_id,l_batch_no,l_day_no,l_eqp,l_parameter_uom,l_action_limit_max,l_action_limit_min,l_control_limit_max,l_control_limit_min,l_center_line,l_parameter_value,l_date;
exit when l_cr%notfound;
--PIPE ROW(PARAMETER_OBJ (l_batch_id,l_batch_no,l_day_no,l_col_desc,l_parameter_value,l_parameter_uom,l_action_limit_max,l_action_limit_min,l_control_limit_max,l_control_limit_min,l_center_line,l_eqp,'1',l_tbl_lst(j),l_col_lst(j),l_date) );
-- [T]: TO_REMOVE: Changed code to populate the temporary table.
INSERT INTO TMP_PARAMETER VALUES (l_batch_id,l_batch_no,l_day_no,l_col_desc,l_parameter_value,l_parameter_uom,l_action_limit_max,l_action_limit_min,l_control_limit_max,l_control_limit_min,l_center_line,l_eqp,'1',l_tbl_lst(j),l_col_lst(j),l_date);
end loop;
close l_cr;
elsif l_tbl_lst(j) in ('SPINNER_SAMPLES') then
open l_cr for l_sql using l_batch_lst(k),l_tbl_lst(j),l_col_lst(j),1,l_day_lst(j),l_eqp_lst(j);
loop
null;
fetch l_cr into l_batch_id,l_batch_no,l_day_no,l_eqp,l_parameter_uom,l_action_limit_max,l_action_limit_min,l_control_limit_max,l_control_limit_min,l_center_line,l_parameter_value,l_date;
exit when l_cr%notfound;
--PIPE ROW(PARAMETER_OBJ (l_batch_id,l_batch_no,l_day_no,l_col_desc,l_parameter_value,l_parameter_uom,l_action_limit_max,l_action_limit_min,l_control_limit_max,l_control_limit_min,l_center_line,l_eqp,'1',l_tbl_lst(j),l_col_lst(j),l_date) );
-- [T]: TO_REMOVE: Changed code to populate the temporary table.
INSERT INTO TMP_PARAMETER VALUES (l_batch_id,l_batch_no,l_day_no,l_col_desc,l_parameter_value,l_parameter_uom,l_action_limit_max,l_action_limit_min,l_control_limit_max,l_control_limit_min,l_center_line,l_eqp,'1',l_tbl_lst(j),l_col_lst(j),l_date);
end loop;
close l_cr;
null;
elsif l_tbl_lst(j) in ('SPINNER') then
open l_cr for l_sql using l_batch_lst(k),l_tbl_lst(j),l_col_lst(j),1,l_eqp_lst(j);
loop
null;
fetch l_cr into l_batch_id,l_batch_no,l_day_no,l_eqp,l_parameter_uom,l_action_limit_max,l_action_limit_min,l_control_limit_max,l_control_limit_min,l_center_line,l_parameter_value,l_date;
exit when l_cr%notfound;
-- PIPE ROW(PARAMETER_OBJ (l_batch_id,l_batch_no,l_day_no,l_col_desc,l_parameter_value,l_parameter_uom,l_action_limit_max,l_action_limit_min,l_control_limit_max,l_control_limit_min,l_center_line,l_eqp,'1',l_tbl_lst(j),l_col_lst(j),l_date) );
-- [T]: TO_REMOVE: Changed code to populate the temporary table.
INSERT INTO TMP_PARAMETER VALUES (l_batch_id,l_batch_no,l_day_no,l_col_desc,l_parameter_value,l_parameter_uom,l_action_limit_max,l_action_limit_min,l_control_limit_max,l_control_limit_min,l_center_line,l_eqp,'1',l_tbl_lst(j),l_col_lst(j),l_date);
end loop;
close l_cr;
elsif l_tbl_lst(j) in ('F1250L_TEST','F200L_TEST','F4000L_TEST','F8000L_TEST') then
null;
open l_cr for l_sql using l_batch_lst(k),l_tbl_lst(j),l_col_lst(j),1,l_day_lst(j);
loop
null;
fetch l_cr into l_batch_id,l_batch_no,l_day_no,l_eqp,l_parameter_uom,l_action_limit_max,l_action_limit_min,l_control_limit_max,l_control_limit_min,l_center_line,l_parameter_value,l_date;
exit when l_cr%notfound;
-- PIPE ROW(PARAMETER_OBJ (l_batch_id,l_batch_no,l_day_no,l_col_desc,l_parameter_value,l_parameter_uom,l_action_limit_max,l_action_limit_min,l_control_limit_max,l_control_limit_min,l_center_line,l_eqp,'1',l_tbl_lst(j),l_col_lst(j),l_date) );
-- [T]: TO_REMOVE: Changed code to populate the temporary table.
INSERT INTO TMP_PARAMETER VALUES (l_batch_id,l_batch_no,l_day_no,l_col_desc,l_parameter_value,l_parameter_uom,l_action_limit_max,l_action_limit_min,l_control_limit_max,l_control_limit_min,l_center_line,l_eqp,'1',l_tbl_lst(j),l_col_lst(j),l_date);
end loop;
close l_cr;
else
open l_cr for l_sql using l_batch_lst(k),l_tbl_lst(j),l_col_lst(j),1;
loop
null;
fetch l_cr into l_batch_id,l_batch_no,l_day_no,l_eqp,l_parameter_uom,l_action_limit_max,l_action_limit_min,l_control_limit_max,l_control_limit_min,l_center_line,l_parameter_value,l_date;
exit when l_cr%notfound;
-- PIPE ROW(PARAMETER_OBJ (l_batch_id,l_batch_no,l_day_no,l_col_desc,l_parameter_value,l_parameter_uom,l_action_limit_max,l_action_limit_min,l_control_limit_max,l_control_limit_min,l_center_line,l_eqp,'1',l_tbl_lst(j),l_col_lst(j),l_date) );
-- [T]: TO_REMOVE: Changed code to populate the temporary table.
INSERT INTO TMP_PARAMETER VALUES (l_batch_id,l_batch_no,l_day_no,l_col_desc,l_parameter_value,l_parameter_uom,l_action_limit_max,l_action_limit_min,l_control_limit_max,l_control_limit_min,l_center_line,l_eqp,'1',l_tbl_lst(j),l_col_lst(j),l_date);
end loop;
close l_cr;
null;
end if;
end loop;-- end of for loop for j in 1..l_k loop
end loop; --end of for j in 1..l_n loop
-- [T]: TO_REMOVE: Return the data from the temporary table into the table type.
-- Return data into table type.
SELECT CAST (MULTISET (SELECT * FROM TMP_PARAMETER)
AS PARAMETER_TYP )
INTO tblParameters FROM DUAL;
-- [T]: TO_REMOVE: Added commit so that the data in the temporary table is deleted.
COMMIT;
-- [T]: TO_REMOVE: Return the table type.
-- return ;
RETURN tblParameters;
EXCEPTION
WHEN OTHERS THEN
--l_sqlerm:=substr(sqlerrm,1,200);
ROLLBACK;
RAISE_APPLICATION_ERROR (-20001, SQLERRM);
return NULL;
END;
# Select sql statement
select *
from table(T_Get_ParameterValue('A03052','-1-SPINNER-CELL_AGE-15L,3-SPINNER-DOUBLING_TIME-15L')) -
REPALCE() function issue. String getting truncated.
Hi,
I am using ORACLE DATABASE 11g. I am facing a very strange problem. I have a string in an variable when i print that sting i can see that the string is correct but after applying a replace function on to it when i print the string the string is incomplete.
Details are as follows :- In the code i am getting some DDL statement (alter table ) , this is the difference between the 2 compared tables. Then I want to place ';' at the last of each line and keyword 'BEGIN' at start and 'END;' at the last. I tried to do this with replace() function but the output string is shot than needed. Please follow the code :-
dbms_output.put_line('V_TAB_DIFF_ALTER:=' || V_TAB_DIFF_ALTER); -- Print the original string. Variable datatype used varchar2(32767)/CLOB
dbms_output.put_line('SOURCE Size := '||Length(V_TAB_DIFF_ALTER)); -- Size of the original string.
V_TAB_DIFF_ALTER_REP :=V_TAB_DIFF_ALTER; -- Placed the sting in new variable.
V_TAB_DIFF_ALTER_REP := 'BEGIN '||replace(V_TAB_DIFF_ALTER_REP,CHR(10),';') || ' END;'; -- Used the replace function and concatenate string.
-- EXECUTE IMMEDIATE V_TAB_DIFF_ALTER_REP;
dbms_output.put_line('After replace := '||V_TAB_DIFF_ALTER_REP); -- Now again printing the sting but this time its not proper.The output is as follows :-
V_TAB_DIFF_ALTER:=ALTER TABLE "NGPR2ST"."FLX_DD_ACCOUNTS_B" ADD ("BENEFICIARY_ACCOUNT_ID" VARCHAR2(32))
ALTER TABLE "NGPR2ST"."FLX_DD_ACCOUNTS_B" ADD ("HAS_OFFSET_ACCOUNT" CHAR(1) DEFAULT 'N')
ALTER TABLE "NGPR2ST"."FLX_DD_ACCOUNTS_B" ADD ("MARKET_ENTITY" VARCHAR2(40))
ALTER TABLE "NGPR2ST"."FLX_DD_ACCOUNTS_B" ADD ("FUTURE_PREVIOUS_STATUS" VARCHAR2(50))
ALTER TABLE "NGPR2ST"."FLX_DD_ACCOUNTS_B" ADD ("PREVIOUS_STATUS" VARCHAR2(50))
ALTER TABLE "NGPR2ST"."FLX_DD_ACCOUNTS_B" ADD ("FUTURE_AS_OF_COUNTER" NUMBER)
ALTER TABLE "NGPR2ST"."FLX_DD_ACCOUNTS_B" ADD ("FUTURE_AS_OF_DATE" DATE)
ALTER TABLE "NGPR2ST"."FLX_DD_ACCOUNTS_B" ADD ("STMT_CYCLE_DAY" NUMBER)
ALTER TABLE "NGPR2ST"."FLX_DD_ACCOUNTS_B" ADD ("PREVENT_EXCESS_FLAG" CHAR(1))
ALTER TABLE "NGPR2ST"."FLX_DD_ACCOUNTS_B" ADD ("TEMP_EXCESS_START_DATE" DATE)
ALTER TABLE "NGPR2ST"."FLX_DD_ACCOUNTS_B" ADD ("TEMP_EXCESS_EXPIRY_DATE" DATE)
ALTER TABLE "NGPR2ST"."FLX_DD_ACCOUNTS_B" ADD ("TEMP_EXCESS_SANCTIONED_AMT" NUMBER)
SOURCE Size := 1830 -- Length of original string.
After replace := BEGIN ALTER TABLE "NGPR2ST"."FLX_DD_ACCOUNTS_B" ADD ("BENEFICIARY_ACCOUNT_ID" VARCHAR2(32));
ALTER TABLE "NGPR2ST"."FLX_DD_ACCOUNTS_B" ADD ("HAS_OFFSET_ACCOUNT" CHAR(1) DEFAULT 'N');
ALTER TABLE "NGPR2ST"."FLX_DD_ACCOUNTS_B" ADD ("MARKET_ENTITY" VARCHAR2(40));
ALTER TABLE "NGPR2ST"."FLX_DD_ACCOUNTS_B" ADD ("FUTURE_PREVIOUS_STATUS" VARCHAR2(50));
ALTER TABLE "NGPR2ST"."FLX_DD_ACCOUNTS_B" ADD ("PREVIOUS_STATUS" VARCHAR2(50));
ALTER TABLE "NGPR2ST"."FLX_DD_ACCOUNTS_B" ADD ("FUTURE_AS_OF_COUNTER" NUMBER);
ALTER TABLE "NGPR2ST"."FLX_DD_ACCOUNTS_B" ADD ("FUTURE_AS_OF_DATE" DATE);
ALTER TABLE "NGPR2ST"."FLX_DD_ACCOUNTS_B" ADD ("STMT_CYCLE_DAY" NUMBER);
ALTER TABLE "NGPR2ST"."FLX_DD_ACCOUNTS_B" ADD ("PREVENT_EXCESS_FLAG" CHAR(1));
ALTER TABLE "NGPR2ST"."FLX_DD_ACCOUNTS_B" ADD ("TEMP_EXCESS_START_DATE" DATE);
ALTER TABLE "NGPR2ST"."FLX_DD_ACCOUNTS_B" ADD ("TEMP_EXCESS_EXPIRY_DATE" DATE);
ALTER TABLE "NGPR2ST"."FLX_DD_ACCOUNTS_B" ADD ("TEMP_EXCESS_SANCTIONE ------ Here the remaining string is missing.
NEW Var. Length :- 1862 -- Length of the new string but still the printed string is not the perfect one. It only prints 1830 characters, rest are not printed.
{code}
Here you can see that the sting in after replace in actually short and will give error when trying to execute. As you can also see that length of new string is more i.e. 1862 but its reading and writing only 1830 characters => which is the actual size of original string.
Variable datatypes used varchar2(32767) and CLOB. Faced issues in both the cases.
Its very obvious that when i am trying to replace a few things then I can add a bit more to it. Why is it only reading or writing only the 1830 character string not the whole 1862 string ??? How can i get the size as 1862 but not the whole string ??
Let me know any solution on this ...
Thanks in advance.
Edited by: VIRU on Nov 17, 2011 10:24 PMThanks William for your reply.
I have tried with increasing the buffer size by
exec dnms_output.enable(40000000);but still no improvements.
I was able to successful print long strings than this one but when it comes to format it with replace i am facing this scenario.
Let me know if you have any idea. -
SQL> create or replace function my_func
2 return boolean as
3 x boolean;
4 begin
5 x := true;
6 return x;
7 end;
8 /
Function created.
SQL> select my_func from dual;
select my_func from dual
ERROR at line 1:
ORA-06552: PL/SQL: Statement ignored
ORA-06553: PLS-382: expression is of wrong type
SQL>
Above is what I thought was a simple function that returns a boolean value. I am doing a asp.net project and i need a simple function to call as a test. I have written a simple function that returns an int, string already and i dont understand the error above....
Can some one give me an example of a function that returns a boolean value based around a simple table like the emp table for example. That would be great thanks ( or else tell me whats wrong with my simple ha ! function above)I'd rather put some sort of wrapper on the oracle side. The reason for this is that the application i'm building is designed to allow users run functions or procedures and pass as many arguments as they want to the c# class. This is what I've been working on but there are data type issues arising.
create or replace function convFunc
--funcName varchar2
return number
as
a boolean;
b number;
begin
--a := myFunction();
a:=funcName
--Is there any way I can pass in the name of the function to be called
and concatenate the () brackets to it and assign it to a. I tried
funcName:= funcName||(); but it wont let me do that. The second problem is that as the function returns true or false but the function name comes in as a string there is a type mis match... There has to be some way of solving the problem on the oracle side. Again all I want from the user is the function name and parameters
Sorry if i'm annoying people with similar posts
if a=true then
b:=1;
return 1;
else
b:=0;
return 0;
end if;
end; -
Replace function for HTML tags
Hie Guys,
I would like to get rid of the HTML tags from a column/object in my report using the "Replace" function. Basically, I want to replace whatever the content is between "<" & ">" i.e. the opening and closing tags. I know I can use the "Pos" function to identify the position of "<" & ">", but I am not sure exactly how to achieve this in Webi. FYI - "Read content as HTML" & "Read content as Hyperlink" did not resolve the issue. Can anyone please help? Thanks.Hi Jeewan,
It will be very tedious to do this at Webi level.
I have tried below example. It might help you to work around your issue; however, not completely:
1. Created an Excel and inserted single value in first column as:
<html><b>this is yuvraj</b></html>
2. Used it as source and created a Webi report in Rich client.
3. Applied SubStr recursively using Pos function and created below variables:
test : =Substr([column_1]; Pos([column_1];">")+1;Length([column_1]))
test1: =Substr([test]; Pos([test];">")+1;Length([test]))
test2 : =Substr([test1]; 0;Pos([test1];"<")-1)
The output has been attached. -
I have a BO Webi user who is unable to perform the Replace function. She is able to schedule the report. But, if she wants to change the scheduler by replacing the new time interval, the Replace function doesn't appear. We go into History, click on Action, and click on Reschedule, and there's no Replace appearing in the list (Instance Title, Recurrence, Format & Destination, Caching, Events, Scheduling Server Grou). Replace is missing from the original report scheduled. Does anyone know why? Do I (designer) have to enable some permission on the CMC for this user?
Thanks.It is authorization issue.
check with your admin.
Bashir Awan -
Hi Guys,
The below is just a query. Given are two codes for a function, when I executed the first it was giving erronous result and was taking about 2 minutes to give out that error but when I made the changes in second and executed it worked perfectly fine and that too withing 2 secs.
Code 1:
CREATE OR REPLACE FUNCTION BUSOBJ.pos_countrycode_lookup (
record_locator VARCHAR2,
pnr_creation_date VARCHAR2
RETURN VARCHAR2
IS
pnr_id NUMBER;
city_code VARCHAR2 (10 BYTE);
country_code VARCHAR2 (10 BYTE);
record_loc VARCHAR2 (10 BYTE);
pnr_create_dt DATE;
org_booking_city VARCHAR2 (10 BYTE);
org_booking_agent VARCHAR2 (10 BYTE);
org_booking_city_code VARCHAR2 (10 BYTE);
rec_iso_country_code VARCHAR2 (10 BYTE);
gds_country_code VARCHAR2 (10 BYTE);
is_country_code VARCHAR2 (10 BYTE);
BEGIN
BEGIN
SELECT ph.pnr_id_pk, ph.record_locator, ph.pnr_creation_date_time,
ph.original_booking_city, ph.original_booking_agent,
ph.original_booking_city_code, pd.rec_loc_iso_country_code,
pd.gds_location_country_iso, ph.iso_country_code
INTO pnr_id, record_loc, pnr_create_dt,
org_booking_city, org_booking_agent,
org_booking_city_code, rec_iso_country_code,
gds_country_code, is_country_code
FROM pnr_hdr ph, pos_details pd
WHERE ph.record_locator = record_locator
AND TRUNC (ph.pnr_creation_date_time) = pnr_creation_date
AND ph.pnr_id_pk = pd.pnr_id_fk
AND ph.delete_flag IS NULL
AND ROWNUM = 1
GROUP BY ph.pnr_id_pk,
ph.record_locator,
ph.pnr_creation_date_time,
ph.original_booking_city,
ph.original_booking_agent,
ph.original_booking_city_code,
pd.rec_loc_iso_country_code,
pd.gds_location_country_iso,
ph.iso_country_code;
END;Code 2:
CREATE OR REPLACE FUNCTION BUSOBJ.pos_countrycode_lookup (
record_locator VARCHAR2,
pnr_creation_date VARCHAR2
RETURN VARCHAR2
IS
pnr_id NUMBER;
city_code VARCHAR2 (10 BYTE);
country_code VARCHAR2 (10 BYTE);
record_loc VARCHAR2 (10 BYTE);
pnr_create_dt DATE;
org_booking_city VARCHAR2 (10 BYTE);
org_booking_agent VARCHAR2 (10 BYTE);
org_booking_city_code VARCHAR2 (10 BYTE);
rec_iso_country_code VARCHAR2 (10 BYTE);
gds_country_code VARCHAR2 (10 BYTE);
is_country_code VARCHAR2 (10 BYTE);
pnr_locator VARCHAR2 (10 BYTE);
pnr_date VARCHAR2 (20 BYTE);
BEGIN
pnr_locator := record_locator;
pnr_date := pnr_creation_date;
BEGIN
SELECT ph.pnr_id_pk, ph.record_locator, ph.pnr_creation_date_time,
ph.original_booking_city, ph.original_booking_agent,
ph.original_booking_city_code, pd.rec_loc_iso_country_code,
pd.gds_location_country_iso, ph.iso_country_code
INTO pnr_id, record_loc, pnr_create_dt,
org_booking_city, org_booking_agent,
org_booking_city_code, rec_iso_country_code,
gds_country_code, is_country_code
FROM pnr_hdr ph, pos_details pd
WHERE ph.record_locator = pnr_locator
AND TRUNC (ph.pnr_creation_date_time) = pnr_date
AND ph.pnr_id_pk = pd.pnr_id_fk
AND ph.delete_flag IS NULL
AND ROWNUM = 1
GROUP BY ph.pnr_id_pk,
ph.record_locator,
ph.pnr_creation_date_time,
ph.original_booking_city,
ph.original_booking_agent,
ph.original_booking_city_code,
pd.rec_loc_iso_country_code,
pd.gds_location_country_iso,
ph.iso_country_code;
END;Please can you gurus suggest what mistake I was making in the first piece of code.
Cheers,
Shaz
Edited by: BluShadow on 20-Feb-2012 16:07
Added {noformat}{noformat} tags for readability. Please read {message:id=9360002} and learn to do this yourself.First statement
WHERE ph.record_locator = record_locator
AND TRUNC (ph.pnr_creation_date_time) = pnr_creation_datedifferent from second statement
WHERE ph.record_locator = pnr_locator
AND TRUNC (ph.pnr_creation_date_time) = pnr_dateAlso , you have other issues where you are potentially disabling an index by
using
TRUNC (ph.pnr_creation_date_time) and the fact that you have and ROWNUM=1 in your statements is a possible cause for concern. in 99% of cases this means your query is not restrictive enough.
It needs investigation.
Also , its possible that your second ran query ran quickly because your first query had already retrieved a lot of the data into the required blocks, thus only requiring a logical read where the first query would have required physical reads.
You would need to do an explain plan on the queries to see if this is the case -
How to make customize Replace function with Positions not pattern ?
Hi
Due to Repalce with patterns in flex, i am facing issue.
I want to make cutomize replace function with parameters
1 Parameter - String to replace
2 Parameter - Start Posion.
3 Parameter - Last position
which return string value.
For Example
replaceInWholeString(str:String, sPos:Number, lPos:Number ):String
values like
1st paramter - "asked"
2nd Paramter - 11
3rd Paramter - 15
Original String :: I want to reply
Output string : I want to asked
Please Reply ,if someone having solution
Thanks
Sunil RanaYou can use any number of the String methods to acomplish this.
I would proabably go with something like: slice(...) + input + substr(...); -
Hi all
I'm trying to convert an xml document from one format to another format.I'm writing a stylesheet for this.I'm kind of new to XSLT.What I want is to replace a string with another only if exact match occurs for eg:
if i'm looking for the string "input" in the document it should replace only input variable in the following string but not "input_array".
<function_code>
y = input_array[0];
yp = 0;
time_previous = time_array[0];
result_array[0] = y;
for (int i = 1; i < channel_size; ++i) {
double input = input_array;
double time = time_array[i];
double h = time - time_previous;
double k = h/2.0;
double A = k*(omega_sq*input - 2*zeta*omega*yp - omega_sq*y); //k*calculate_ypp( time, y, yp, input );
double Beta = k*(yp + A/2.0);
double B = k*(omega_sq*input - 2*zeta*omega*(yp+A) - omega_sq*(y+Beta)); //B = k*calculate_ypp(time+k, y+Beta, yp+A, input);
double C = k*(omega_sq*input - 2*zeta*omega*(yp+B) - omega_sq*(y+Beta)); //C = k*calculate_ypp(time+k, y+Beta, yp+B, input);
result_array[i] = C;
} </function__code>
,the replace function XSLT provides replaces all occurrences of input i.e input followed by anything.Is there a way to do it??
thanks for your time and valuable inputs.
SreeHi
I wrote my own functions to check for the exact match and replace but i have another issue,since there is no variable reassignment in xslt how should i implement something like this
replace_code = replace_all_names(oldname,newname,replace_code);
where replace_code consists my code replaced and once any replacement occurs i have to pass it as an input for the next replacement.
thanks
Sree -
Can I use Replace function in a decode??
Hello,
I am trying to use replace function inside a Decode Function,
Here is how I am doing it:
select
SUBSTR (
DECODE (
IH.DRVD_ALT_MAIL_ADDR_PRIM_FLAG,
'N',
REPLACE (
ih.subs_addr_1
|| ' '
|| ih.subs_addr_2
|| ' '
|| ih.subs_city
|| ','
|| ih.subs_state_code
|| ' '
|| ih.subs_zip_code,
'Y',
REPLACE (
IH.PRINT_ALT_MAIL_ADDR_LINE_1
|| ' '
|| IH.PRINT_ALT_MAIL_ADDR_LINE_2
|| ' '
|| IH.PRINT_ALT_MAIL_ADDR_LINE_3
|| ' '
|| IH.PRINT_ALT_MAIL_ADDR_LINE_4
|| ' '
|| IH.PRINT_ALT_MAIL_ADDR_LINE_5
|| ' '
|| IH.PRINT_ALT_MAIL_ADDR_LINE_6,
) 1,
50
address from x
Can anyone please tell me what am I doing wrong here, It always gives me an error about missing a right parenthesis.
Thanks in advance.Hi Jimmy,
Looks like you are missing the first comma in the SUBSTR function
SELECT SUBSTR (
DECODE (
ih.drvd_alt_mail_addr_prim_flag,
'N', REPLACE (
ih.subs_addr_1
|| ' '
|| ih.subs_addr_2
|| ' '
|| ih.subs_city
|| ','
|| ih.subs_state_code
|| ' '
|| ih.subs_zip_code,
'Y', REPLACE (
ih.print_alt_mail_addr_line_1
|| ' '
|| ih.print_alt_mail_addr_line_2
|| ' '
|| ih.print_alt_mail_addr_line_3
|| ' '
|| ih.print_alt_mail_addr_line_4
|| ' '
|| ih.print_alt_mail_addr_line_5
|| ' '
|| ih.print_alt_mail_addr_line_6,
), -- HERE
1,
50
address
FROM xRegards
Peter -
Function issue of Cross-Reference
Hi,
thanks for your attention on this topic.
there is function issue of Cross-Reference.
when click the Cross-Reference after re-installed the software (adobe Framemaker 7.10), the function is not working. please kindly check the screenshots below:
Error message below:
Please help to check this issue.
software: Adobe Framemaker 7.10
System: windows xp sp3
thanks in advance for your support .
Message was edited by: Lu StevenFire the error log off to the e-mail address indicated in the error message and then contact Adobe Support.
-
Replace() function doesn't work in Application Designer?
I'm using PeopleSoft Application Designer 8.51. I'm trying to do a simple Replace function so I can escape single quotes rather than allow them to blow up the sql query.
&deptid = Replace(&deptid, "'", "''");
App Designer chokes when I hit Save: "Invalid function parameter type. (2,19)"
According to the docs I'm using this correctly: http://docs.oracle.com/cd/E26239_01/pt851h3/eng/psbooks/tace/book.htm?File=tace/htm/tace14.htm#H4095
Even if I try to execute the example right out of the documentation, I get the same error: REPLACE("StringFun", "Fun", "Number");
Is this a bug in app designer? REPLACE is a super common thing, it's not something obscure. How can this not work?
Thanks in advance.I figured this out. “Replace” is a strange duck function that relies on offsets. “Substitute” is the magic I needed, works just like I was expecting Replace to work. The documentation I was reading on Replace was for “ PeopleSoft Analytic Calculation Engine” rather than peoplecode. I’ll pay closer attention to that next time. Maybe this will help someone else...
-
Replace function not working for XML CLOB data
Hi all,
I am generating XML using DBMS_XMLGEN in oracle 10g. After generating the XML, I am replacing the ROW tags with appropriate tag name using REPLACE function. Sometimes the tag name is not replaced correctly.
Eg.I am replacing </Cargo_ROW> with </CargoDetail>. But sometimes in one xml, this tag is coming as </CargoDetROW> or </CargoDetaiW>. The XML size is always huge and the same tag is repeated so many time in the loop and in the same XML, only one tag will be replaced incorrectly. This also not happening for all XMLs.
If any one knows the cause about this problem or solution, please share the same.
thanks,Yes Anton, you are right..
It was typecasting problem
replace supports clob
Check this out
SQL> declare
2 xmldata clob;
3 Begin
4 xmldata:='<Message transaction_log_id="" extraction_date="25/11/09 09:52:03 AM" versio
5 <Transaction>
6 <TransactionType>ORIGINAL</TransactionType>
7 <ControlNumber>60022449779</ControlNumber>
8 <BookingHeader>
9 <PortCodeOriginal>GBSOU</PortCodeOriginal>
10 <Contact>.</Contact>
11 <PhoneContact>.</PhoneContact>
12 </BookingHeader>
13 <PartyInformation>
14 <PartyDetails>
15 <PartyId>10002866</PartyId>
16 <Type>SHIP</Type>
17 <Name1>L LTD.</Name1>
18 </PartyDetails>
19 </PartyInformation>
20 <Cargo>
21 <CargoDetROW>
22 <CargoHeader>
23 <CargoReceivedSeqNo>600015391790</CargoReceivedSeqNo>
24 <CargoId>RW9330P013948</CargoId>
25 </CargoHeader>
26 <CargoDimensions>
27 <Length>1</Length>
28 <Width>2</Width>
29 </CargoDimensions>
30 </CargoDetail>
31 <CargoDetROW>
32 <CargoHeader>
33 <CargoReceivedSeqNo>600015391791</CargoReceivedSeqNo>
34 <CargoId>RW9330P01394AA</CargoId>
35 </CargoHeader>
36 <CargoDimensions>
37 <Length>2</Length>
38 <Width>2</Width>
39 </CargoDimensions>
40 </CargoDetail>
41 <Cargo_ROW>
42 <CargoHeader>
43 <CargoReceivedSeqNo>600015391792</CargoReceivedSeqNo>
44 <CargoId>RW9330P01322</CargoId>
45 </CargoDetaiW>
46 <CargoDimensions>
47 <Length>1</Length>
48 <Width>2</Width>
49 </CargoDimensions>
50 </Cargo_ROW>
51 </Cargo>
52 </Transaction>
53 </Message>';
54 xmldata:=to_clob(regexp_replac(xmldata,'</Cargo_ROW>|</CargoDetaiW>|</CargoDetROW>','</CargoDetail'));
55 xmldata:=to_clob(regexp_replace(xmldata,'<Cargo_ROW>|<CargoDetaiW>|<CargoDetROW>','<CargoDetail>'));
56 dbms_output.put_line(xmldata);
57 end;
58 /
<Message transaction_log_id="" extraction_date="25/11/09 09:52:03 AM"
version="1.0">
<Transaction>
<TransactionType>ORIGINAL</TransactionType>
<Contro
lNumber>60022449779</ControlNumber>
<BookingHeader>
<PortCodeOriginal>GBSOU</Por
tCodeOriginal>
<Contact>.</Contact>
<PhoneContact>.</PhoneContact>
</BookingHead
er>
<PartyInformation>
<PartyDetails>
<PartyId>10002866</PartyId>
<Type>SHIP</Ty
pe>
<Name1>L
LTD.</Name1>
</PartyDetails>
</PartyInformation>
<Cargo>
<CargoDetail>
<CargoHea
der>
<CargoReceivedSeqNo>600015391790</CargoReceivedSeqNo>
<CargoId>RW9330P01394
8</CargoId>
</CargoHeader>
<CargoDimensions>
<Length>1</Length>
<Width>2</Width>
</CargoDimensions>
</CargoDetail>
<CargoDetail>
<CargoHeader>
<CargoReceivedSeq
No>600015391791</CargoReceivedSeqNo>
<CargoId>RW9330P01394AA</CargoId>
</CargoHe
ader>
<CargoDimensions>
<Length>2</Length>
<Width>2</Width>
</CargoDimensions>
<
/CargoDetail>
<CargoDetail>
<CargoHeader>
<CargoReceivedSeqNo>600015391792</Carg
oReceivedSeqNo>
<CargoId>RW9330P01322</CargoId>
</CargoDetail>
<CargoDimensions>
<Length>1</Length>
<Width>2</Width>
</CargoDimensions>
</CargoDetail>
</Cargo>
</Transaction>
</Message>
PL/SQL procedure successfully completed.
SQL> Twinkle
Edited by: Twinkle on Nov 26, 2009 6:05 PM -
Prolem in CLOB replace function
Hi,
I am working on Oracle 10g (release 2).
Currently facing problem in replace function
My given patterns are
Replace(+string+, varchar2, clob)
Replace(+String+, clob, clob)
In both casese, I'm getting ORA-22828 error.
Can anyone please suggest the solution.
Thanks.Please see
http://asktom.oracle.com/pls/asktom/f?p=100:11:3388795154384573::::P11_QUESTION_ID:1533006062995 -
Replacement function modules/method for obsolete Funtion Modules in ECC 6.0
We are working on Upgrade Project and need your help in finding the replacement Function module/ Methods for following obsolete Function Modules:
1. GET_FIELDTAB
2. WS_EXCEL
3. HR_DISPLAY_BASIC_LIST
4. LOG_SYSTEM_GET_RFC_DESTINATION
5. HELPSCREEN_NA_CREATE
6. TR_RELEASE_COMM
Thank in Advance.
Sarita.
Edited by: Sarita Yalamati on Mar 28, 2008 1:23 PMHi sarita,
for GET_FIELDTAB use 'DDIF_NAMETAB_GET'..here is sample code
CALL FUNCTION 'GET_FIELDTAB'
EXPORTING
LANGU = SY-LANGU
TABNAME = C_STRUCTURE_NAME
WITHTEXT = ' '
TABLES
FIELDTAB = IDFIES
EXCEPTIONS
INTERNAL_ERROR = 01
NO_TEXTS_FOUND = 02
TABLE_HAS_NO_FIELDS = 03
TABLE_NOT_ACTIV = 04.
Replacement :
CALL FUNCTION 'DDIF_NAMETAB_GET'
EXPORTING
TABNAME = C_STRUCTURE_NAME
ALL_TYPES = ' '
LFIELDNAME = ' '
GROUP_NAMES = ' '
UCLEN =
IMPORTING
X030L_WA =
DTELINFO_WA =
TTYPINFO_WA =
DDOBJTYPE =
DFIES_WA =
LINES_DESCR =
TABLES
X031L_TAB =
DFIES_TAB = IDFIES
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2
For WS_EXCEL use GUI_DOWNLOAD.. here is sample code
CALL FUNCTION 'WS_EXCEL'
EXPORTING
FILENAME = 'D:\FILE1.xls'
SYNCHRON = ' '
TABLES
DATA = itab
EXCEPTIONS
UNKNOWN_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Repalcement :
data : l_filename type string.
l_filename = 'D:\FILE1.xls'.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME = l_filename
FILETYPE = 'ASC'
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = itab
FIELDNAMES =
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>EXECUTE
EXPORTING
DOCUMENT = 'D:\FILE1.xls'
APPLICATION =
PARAMETER =
DEFAULT_DIRECTORY =
MAXIMIZED =
MINIMIZED =
SYNCHRONOUS =
OPERATION = 'OPEN'
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
BAD_PARAMETER = 3
FILE_NOT_FOUND = 4
PATH_NOT_FOUND = 5
FILE_EXTENSION_UNKNOWN = 6
ERROR_EXECUTE_FAILED = 7
SYNCHRONOUS_FAILED = 8
NOT_SUPPORTED_BY_GUI = 9
others = 10
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Maybe you are looking for
-
Text Tool on Tab Control Bug?
I'm trying to create some free labels on a tab control with the text tool and I've found the postion of the text insertion point is off. When I click anywhere on the tab the text appears a few inches above the point that I clicked on. The tool is w
-
Can't open certain pages.
I just got an iMac and have began to use Safari. I really like it.. but oddly, I can't open certain pages that I can on other browsers. (tested this). xbox.com - log in (or any of the Windows Live ID pages) ex: https://login.live.com/login.srf?wa=wsi
-
App Store giving false update figures
I have an iPhone 3GS (iOS 6.1.3 - Software Update says that this is the latest even though 6.1.4 is in the Discussions profile pop-up list) and for the past week or so, the App Store icon has been indicating that there are anything between one and se
-
Something keeps hijacking my Home Page back to Mozilla Firefox
After I have typed a URL into the Tools->Options->General Home Page and OK, it keeps getting set back to Mozilla Home Page by blanking out the field on reboot. Why?
-
Is it possible to convert NTSC to PAL......
on a Mac that is. I made the mistake of buying an NTSC only camcorder through Ebay and whilst I have no problem playing it through my multiregion DVD player I wondered about making DVDs I could give to friends / family who may have region 2 players o