ORA-06528: Error executing PL/SQL profiler
Hai
I would like to see the outcome of package (to view the report on the package).In order to get that
I installed the below package connect as internal
sql>d:\oracle\orq81\rdbms\admin\profload.sql
In order to use dbms_profiler,after that i need to have installed profilling tables ,in order to get i ran proftab.sql ,and its created three tables are
plsql_profiler_data,plsql_profiler_units,plsql+profiler_runs
after that i ran the below procedure
create or replace procedure do_mod as
cnt number := 0;
begin
dbms_profiler.start_profiler( 'mod' );
for i in 1 .. 500000
loop
cnt := cnt + 1;
if ( mod(cnt,1000) = 0 )
then
commit;
end if;
end loop;
dbms_profiler.stop_profiler;
end;/
PL/SQL procedure successfully completed.
exec no_mod
PL/SQL procedure successfully completed.
In order to see the report on packge ,i had query the table , RUN_TOTAL_TIME IS 3.5190E+11(this is seconds)
my qusetion is
1)
Please explain me that is total amount time in seconds or minutes,i donnot understand what is 3.5190e+11
SQL> select RUNID,RUN_COMMENT,RUN_TOTAL_TIME FROM PLSQL_PROFILER_RUNS;
RUNID
RUN_COMMENT
RUN_TOTAL_TIME
1
mod
7.0975E+11
2
mod
6.9767E+11
RUNID
RUN_COMMENT
RUN_TOTAL_TIME
3
no mod
3.5190E+11
2)
I had ran the above script one of the schema ,and successfully created above procedure.When i execte,it retuns below error message
SQL> exec do_mod;
BEGIN do_mod; END;
ERROR at line 1:
ORA-06528: Error executing PL/SQL profiler
ORA-06512: at "SYS.DBMS_PROFILER", line 123
ORA-06512: at "SYS.DBMS_PROFILER", line 132
ORA-06512: at "MOHAN1.DO_MOD", line 4
ORA-06512: at line 1
Any one any idea about that
Regards
mohan
1) Run_total_time is the elapsed total time in nanoseconds.
A nanosecond is one billionth of a second.
It is displayed in scientific notation
where E stands for "times ten to the power of".
So, 3.5190E+11 nanoseconds
= 3.5190 * 100000000000 nanoseconds
= 351900000000 nanoseconds
= 351900000000 billionths of a second
= 351900000000 / 1000000000 seconds
= 351.9 seconds
If you want to display it in seconds, use:
SELECT runid,
run_comment,
run_total_time / 1000000000 AS seconds
FROM plsql_profiler_runs;
2) The only thing that looks wrong about your do_mod procedure
is the last line:
end;/
The / should be on the next line.
Other than that, I don't see any possible cause for
the error.
Similar Messages
-
06528. 00000 - "Error executing PL/SQL profiler"
HI.
i am getting an error -
ORA-06528: Error executing PL/SQL profiler
ORA-06512: at "SYS.DBMS_PROFILER", line 258
ORA-06512: at line 3
06528. 00000 - "Error executing PL/SQL profiler"
*Cause: An error occurred in during execution of a PL/SQL profiler
procedure.
when i try to run the following block
BEGIN
DBMS_PROFILER.START_PROFILER( sysdate,'');
DBMS_PROFILER.FLUSH_DATA;
END;
plz helpRun proftab.sql first. look st the test case. Hopefully you have installed dbms_profiler package. The first anonymous block is to test that, second block is your block which is failing.
SQL> ed
Wrote file afiedt.buf
1 declare
2 var1 binary_integer;
3 var2 binary_integer;
4 begin
5 DBMS_PROFILER.GET_VERSION(Var1,var2);
6 dbms_output.put_line('Var1 '||Var1);
7* end;
8 /
Var1 2
PL/SQL procedure successfully completed.
SQL> BEGIN
2 DBMS_PROFILER.START_PROFILER( sysdate,'');
3 DBMS_PROFILER.FLUSH_DATA;
4 END;
5 /
BEGIN
ERROR at line 1:
ORA-06528: Error executing PL/SQL profiler
ORA-06512: at "SYS.DBMS_PROFILER", line 123
ORA-06512: at "SYS.DBMS_PROFILER", line 132
ORA-06512: at line 2
SQL> @C:\oraclexe\app\oracle\product\10.2.0\server\RDBMS\ADMIN\proftab.sql
SQL> BEGIN
2 DBMS_PROFILER.START_PROFILER( sysdate,'');
3 DBMS_PROFILER.FLUSH_DATA;
4 END;
5 /
PL/SQL procedure successfully completed. -
ORA-00604: error at recursive sql level 1ORA-01882: timezone region not fou
hello eveyone i have installed SQL developer and try to create a connexion but it shows the following error:
" : ORA-00604: error at recursive sql level 1ORA-01882: timezone region not found"
(i choosed TNS as connexion type , default as rol )
plz help
thanksHi Raccio,
Using the forum search functionality, I came across the following threads with some tips that might help you:
ORA-00604 & ORA-01804 when connecting to Oracle 11 database 11.1.0.6.0
ora-01882 "timezone region not found" with 3.0.03.97 but not with 3.0.03.45
Regards,
Gary Graham
SQL Developer Team
Edited by: gggraham on Jul 20, 2011 1:03 PM -
XL Reporter Installation - Error executing IXMetaProcs.sql
Hi All,
During installation getting error-
Error Preparing Metadata Repository:
Executing SQL script 'IXMetaProcs.sql' (Start:....)
ExitCode -1073741819
!!! ERROR Error executing IXMetaProcs.sql ExitCode -1073741819
I have done the following checks.
1. XL Reporter has bee removed from Administrator->Add-On Administrator.
2. Add-Remove List Does not show XL Reporter.
3. Removed manually Database IXMetaSBOOEM from SQL Server.
4. %temp% - > SM_OBS_DLL folder not found.
5. ILytix folder not found in HKEY_CURRENT_USER -> Software
ILytix folder not found in HKEY_LOCAL_MACHINE-> Software
6. There is no other add-on installed
7. AddOnsInstall.sbo deleted.
AddOnsLocalRegistration.sbo not found.
8. C:\Prog Files\SAP\SAP Business One\Add-Ons folder not found.
But still I can't install XL Reporter.hi,
first you have to check that you have install "dot. Net Framework 2.0" which is compulsory needed for installing XL reporter, also you have to install MS Office in your system.
uninstall the XL reporter and install using the following steps
installation steps of XL-reporter add-on,
1. goto add-on administration => Register Add-on(click).
give the XL reporter address. select default group as Manual.
update.
2. goto addon manager => pending Add-on tab => select the addon row and install.
in installation give the user id and pwd of SQL server.
3.goto addon manager =>installed addons tab, start the XL reporter, once it get connected as status.
4. go to tools menu in SAP B1, in that you will find XL reporter, click that XL reporter will open.(to view XL reporter)
follow the above steps you will get the XL repoter add-on running in SAP B1.
regards
sandip -
Error executing MS sql server procedure
I am getting an error below while executing a SQL server procedure from SOA composite. My jdeveloper and Soa Suite version is 11.1.1.4.
I am using “Oracle’s MS SQL Server Driver (Type 4) Version: 7.0 and later” driver. The SQL Server version is 2005.
To configure the connection I used the steps mentioned in URL below.
http://beatechnologies.wordpress.com/2011/01/31/creating-a-dbadapter-for-mssql-server-in-osb-11g/
The MS SQL procedure signature is as below.
@p_EventId nvarchar IN
@p_EventName_IN nvarchar IN
@p_Agreement_No_IN decimal IN
@p_Acc_Base_Number_IN decimal IN
@p_Acc_Comp_No_IN decimal IN
@p_Account_Company_Name_IN nvarchar IN
@p_Agree_Stat_Code_IN nvarchar IN
@p_Agree_Type_Code_IN nvarchar IN
@p_HeadQtr_Code_IN nvarchar IN
@p_Sales_Off_Name_IN nvarchar IN
@p_Reseller_Name_IN nvarchar IN
@p_Oracle_Order_number_IN decimal IN
@p_License_Effective_Date_IN datetime IN
@p_PO_Number_IN decimal IN
@p_Invoice_Number_IN decimal IN
@p_Invoice_Date_IN datetime IN
@p_Support_Contract_ID_IN decimal IN
@p_Stmt_Of_Capacity_Due_Date_IN datetime IN
@p_Contract_Start_Date_IN datetime IN
@p_Contract_End_Date_IN datetime IN
@p_Contract_Type_IN nvarchar IN
Error message .
<fault>
<bpelFault>
<faultType>0</faultType>
<bindingFault>
<part name="summary">
<summary>Exception occured when binding was invoked. Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'CompanySPProdcall' failed due to: Unimplemented object conversion. Conversion of type 1 whose JDBC type is OTHER to a Java object is not supported. An attempt was made to convert type 1 to a Java object using an unsupported JDBC type: OTHER. Use a data type with a supported JDBC type. ". The invoked JCA adapter raised a resource exception. Please examine the above error message carefully to determine a resolution. </summary>
</part>
<part name="detail">
<detail>Unimplemented object conversion. Conversion of type 1 whose JDBC type is OTHER to a Java object is not supported. An attempt was made to convert type 1 to a Java object using an unsupported JDBC type: OTHER. Use a data type with a supported JDBC type. </detail>
</part>
<part name="code">
<code>null</code>
</part>
</bindingFault>
</bpelFault>
</fault>
Please let me know the solution for this issue?
Thanks...I had the similar problem and I am using 11.1.1.5.
When I changed the platformClassName to org.eclipse.persistence.platform.database.SQLServerPlatform it worked.
You can find platformClassName in Outbound Connection Properties
Hope this might work :) -
Hii All,
I'm facing the following error
ERROR at line 66:
ORA-06550: line 66, column 20:
PLS-00306: wrong number or types of arguments in call to '||'
ORA-06550: line 66, column 11:
PL/SQL: Statement ignoredVersion Details
SQL> select * from v$version;
BANNER
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
PL/SQL Release 11.1.0.7.0 - Production
CORE 11.1.0.7.0 Production
TNS for Solaris: Version 11.1.0.7.0 - Production
NLSRTL Version 11.1.0.7.0 - ProductionMy pl sql block
Declare
p_table_name clob := 'CP_CA_DTLS' ;
Type t_column_name_tab is table of varchar2(4000)
index by binary_integer;
l_table_tab t_column_name_tab;
l_file_name constant varchar2(5000) := 'column_counts';
l_count number;
l_tab_count number;
l_str varchar2(32000);
l_tbl_str varchar2(32000);
Cursor c_table_columns(c_table_name user_tables.table_name%type)
Is
Select column_name
from user_tab_cols
where table_name = upper(c_table_name);
Type t_table_columns is table of c_table_columns%rowtype;
l_column_name_tab t_table_columns;
Begin
--Splitting comma seperated data
Select regexp_substr(p_table_name,'[^,]+{1}',1,level)
bulk collect into l_table_tab
from dual
connect by level <= length(regexp_replace(p_table_name,'[^,]*'))+1;
for k in 1..l_table_tab.count
loop
-- dbg_print(l_file_name,'***'||l_table_tab(k)||'***');
Begin
l_tbl_str := 'Select count(*) from '||l_table_tab(k);
execute immediate l_tbl_str into l_tab_count;
-- dbg_print(l_file_name,'Overall Count of table '||l_table_tab(k)||' is '||l_tab_count);
End;
-- dbg_print(l_file_name,'Column Name '||','||'Count');
Open c_table_columns(l_table_tab(k));
loop
Fetch c_table_columns bulk collect into l_column_name_tab limit 50;
exit when l_column_name_tab.count = 0;
dbms_output.put_line('l_column_name_tab.count count is : '||l_column_name_tab.count);
for i in 1..l_column_name_tab.count
loop
Begin
l_str := 'Select count(*) ' ;
l_str := l_str||' from '||l_table_tab(k) ;
l_str := l_str||' where '||l_column_name_tab(i);
l_str := l_str||' is null' ;
Execute Immediate l_str into l_count;
End;
--dbg_print(l_file_name,l_column_name_tab(i)||','||l_count);
end loop;
end loop;
Close c_table_columns;
end loop;
dbms_output.put_line('l_column_name_tab.count count is : '||l_column_name_tab.count);
End;Even I'm not able to print l_column_name_tab(i) using dbms_output.
(Later I came to know that this information can be achieved using user_tab_col_statistics table)
But would like to know whats wrong with my code.???
Plz help me .
Edited by: 792353 on Dec 3, 2010 1:26 AMHii RDB,
when I comment this part of code
-- l_str := l_str||' where '||l_column_name_tab(i);
-- l_str := l_str||' is null' ;
SQL> Declare
2
3
4 p_table_name clob := 'CP_CA_DTLS' ;
5
6 Type t_column_name_tab is table of varchar2(4000)
7 index by binary_integer;
8
9 l_table_tab t_column_name_tab;
10
11
12
13
14 l_file_name constant varchar2(5000) := 'column_counts';
15 l_count number;
16 l_tab_count number;
17 l_str varchar2(32000);
18 l_tbl_str varchar2(32000);
19
20 Cursor c_table_columns(c_table_name user_tables.table_name%type)
21 Is
22 Select column_name
23 from user_tab_cols
24 where table_name = upper(c_table_name);
25
26
27 Type t_table_columns is table of c_table_columns%rowtype;
28
29
30 l_column_name_tab t_table_columns;
31
32 Begin
33 --Splitting comma seperated data
34
35 Select regexp_substr(p_table_name,'[^,]+{1}',1,level)
36 bulk collect into l_table_tab
37 from dual
38 connect by level <= length(regexp_replace(p_table_name,'[^,]*'))+1;
39
40 for k in 1..l_table_tab.count
41 loop
42 -- dbg_print(l_file_name,'***'||l_table_tab(k)||'***');
43
44 Begin
45 l_tbl_str := 'Select count(*) from '||l_table_tab(k);
46
47 execute immediate l_tbl_str into l_tab_count;
48
49 -- dbg_print(l_file_name,'Overall Count of table '||l_table_tab(k)||' is '||l_tab_coun
t);
50
51 End;
52
53 -- dbg_print(l_file_name,'Column Name '||','||'Count');
54
55 Open c_table_columns(l_table_tab(k));
56 loop
57 Fetch c_table_columns bulk collect into l_column_name_tab limit 50;
58 exit when l_column_name_tab.count = 0;
59 dbms_output.put_line('l_column_name_tab.count count is : '||l_column_name_tab.count);
60 for i in 1..l_column_name_tab.count
61 loop
62
63 Begin
64 l_str := 'Select count(*) ' ;
65 l_str := l_str||' from '||l_table_tab(k) ;
66 -- l_str := l_str||' where '||l_column_name_tab(i);
67 -- l_str := l_str||' is null' ;
68
69 Execute Immediate l_str into l_count;
70
71 End;
72
73 --dbg_print(l_file_name,l_column_name_tab(i)||','||l_count);
74
75 end loop;
76 end loop;
77 Close c_table_columns;
78 end loop;
79
80 dbms_output.put_line('l_column_name_tab.count count is : '||l_column_name_tab.count);
81 End;
82 /
PL/SQL procedure successfully completed.its running fine so the problem is l_column_name_tab(i) !!!!!!
and there is nothing wrong with l_table_tab(k) and its declaration.
Edited by: 792353 on Dec 3, 2010 2:17 AM -
Hi,
I am working in oracle9i and solaris 8.If i execute a package in Pl/sql it shows error as
ora-03113 end-of-file on communication channel...
but the same package if i executed in TOAD means it's working fine ....
Please explain me...If i execute a package in Pl/sql Do you mean in SQL*Plus (as opposed to TOAD)?
ORA-3113 is a generic error, usually meaning the client did something the server didn't like. This can often be caused by incompatibilities between the versions of the client and the database server.
Unfortunately the generic nature of teh error makes it hard for us to give you a specific answer, Is there anything in the alert log file?
Cheers, APC -
Version 3.1 fault - ORA-06502 error when creating SQL Report Region/Page
I usually perfect my query in SQL*PLUS before I create a new report region.
Consequently, I copy the code into the region wizard to create the new page. However, since we have upgraded to Version 3.1, virtually every report I have tried to create has created the following error:
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
It would appear that a maximum of 960 characters can be used to create the region/page. Perversely, once the page/region has been created, I can then edit the source and include as much code as I want (so far I've not run up against a limit)
As it's just annoying, but not stopping me doing what I wanted to do, I've not got around to mentioning this error previously, but it occurred to me that I should (so I am!)
DavidHi David,
Thank you for reporting this. Unfortunately, this was a regression introduced in Application Express 3.1. The workaround is to edit the region, as you suggested. This has been filed as Bug 6956070 and will be corrected in the forthcoming Application Express 3.1.1 patch set.
Joel -
ORA-00933 - Error in PL/SQL for Form with report.
Hello,
I am getting this error :
failed to parse SQL query:
ORA-00933: SQL command not properly ended
and my PL/SQL function body returning SQL is as follows:
Declare
q varchar2(32767);
w varchar2(4000);
v_total varchar2(10);
Begin
v_total:='TOTAL' ;
q:=' SELECT ASR_DB_CLIENT.CLIENT_NAME, ';
q:=q||' ASR_DB_OIS.ACCT_NAME, ';
q:=q||' ASR_DB_OIS.ACCT_NBR, ';
q:=q||' ASR_DB_OIS.INCEPT_DT, ';
q:=q||' asr_db_prod.MKT_CODE, ';
q:=q||' asr_db_prod.asst_clss, ';
q:=q||' ASR_DB_OIS.PROD_CODE, ';
q:=q||' ASR_DB_OIS.GROUP_CODE, ';
q:=q||' ASR_DB_PLAN.TAX_STAT, ';
q:=q||' asr_db_clnt_type.clnt_type_name, ';
q:=q||' asr_db_plan_type.plan_type_name, ';
q:=q||' ASR_DB_OIS.ACCT_type, ';
q:=q||' ASR_DB_PLAN.CNTRY_CODE, ';
q:=q||' ASR_DB_OIS.DISCRET_FLAG, ';
q:=q||' ASR_DB_OIS.ASST_BAL ';
q:=q||' FROM ASR_DB_OIS, ASR_DB_PLAN, ASR_DB_CLIENT, ASR_DB_PROD, ';
q:=q||' asr_db_plan_type, ';
q:=q||' asr_db_Clnt_type ';
q:=q||' WHERE';
q:=q||' ASR_DB_OIS.PLAN_ID = ASR_DB_PLAN.PLAN_ID and ';
q:=q||' ASR_DB_OIS.as_of_dt = ASR_DB_PLAN.as_of_dt and ';
q:=q||' ASR_DB_PLAN.CLIENT_ID = ASR_DB_CLIENT.CLIENT_ID and ';
q:=q||' ASR_DB_OIS.as_of_dt = ASR_DB_CLIENT.as_of_dt and ';
q:=q||' asr_db_ois.prod_code = asr_db_prod.prod_code and ';
q:=q||' ASR_DB_PLAN.plan_type_code = ASR_DB_PLAN_type.plan_type_code and ';
q:=q||' ASR_DB_Client.clnt_type_code = ASR_DB_clnt_type.clnt_type_code and ';
q:=q||' ASR_DB_OIS.AS_OF_DT = :p99_asofdate ';
IF :P2_ROLLUPSLEEVE = 'RU'
THEN
q :=q||' and ASR_DB_OIS.PARENT_OIS_ID is null ';
Else
q :=q||' and ASR_DB_OIS.ACCT_TYPE like "%"'||v_total||'"%" ';
q :=q||' and ASR_DB_OIS.PARENT_OIS_ID is not null ';
END IF;
return q;
end;
Why this is failing ?
Is "%"'||v_total||'"%" '; incorrect ?
P2_ROLLUPSLEEVE is a radio button.
Please advise....
Thanks,
HMAnd
Also, I get the following error when I try few other things like
q :=q||' and ASR_DB_OIS.ACCT_TYPE = '||v_total||' ';
or
q :=q||' and ASR_DB_OIS.ACCT_TYPE = "||v_total||" ';
failed to parse SQL query:
ORA-00904: "TOTAL": invalid identifier
And
ORA-06550: line 43, column 41: PLS-00103: Encountered the symbol "TOTAL" when expecting one of the following: * & = - + ; < / > at in is mod remainder not rem <> or != or ~= >= <= <> and or like LIKE2_ LIKE4_ LIKEC_ between || member SUBMULTISET_ The symbol "* was inserted before "TOTAL" to continue.
When I try
q :=q||' and ASR_DB_OIS.ACCT_TYPE = "'TOTAL'" ';
Any helpful tips will be much appreciated.
Thanks,
HM -
Error executing Catproc.sql (URGENT!)
I am trying to create a database on Oracle805 on Linux v6 and when I try executing the Catproc.sql, the script just stops halfway.
I went in to execute each script in the Catproc.sql script systematically and found that the processing stops in the midst of the execution of prvtutil.plb.
What could have gone wrong? I desperately need help. Will appreciate it if someone can help to advise me on this.
Thank you.It would be interesting if you tell wheter there are any error messages?
Make sure to run catproc as user SYS.
Try re-running catalog.sql first. -
Unix Shell Script -- ORA-00905 error in pl/sql
Below is my unix shell script .... in which i am trying to caluclate difference between time stamps ..... i am getting a severe error when i run --- ORA-00905: missing keyword ( included it bottom of this post )
please look into this and let me know where to correct ....
much appreciated in adv
~~~~~~~~~~~~~~~~~~~~~START of Script~~~~~~~~~~~~~~~~~~~~
#!/bin/ksh
export readTime checkTime timeDiff
# Get initial Time
readTime=`sqlplus -s scott/tiger@database <<EOF
whenever sqlerror exit 1
set escape off
set head off
set verify off
select SYSTIMESTAMP from dual;
EOF
`
echo "readTime value is : $readTime"
# Get end of time
checkTime=`sqlplus -s scott/tiger@database <<EOF
whenever sqlerror exit 1
set escape off
set head off
set verify off
select SYSTIMESTAMP from dual;
EOF
`
echo "value of checkTime : $checkTime"
# calculate time diff
timeDiff=`sqlplus -s scott/tiger@database <<EOF
whenever sqlerror exit 1
set escape off
set head off
set verify off
select CAST(TO_DATE('$time2','''YYYY\/MM\/DD:HH24:MI:SS'''))-CAST(TO_DATE('$VAR1','YYYY-MM-DD:HH24:MI:SS')) from dual;
EOF
`
echo "value of timeDiff : $timeDiff"
~~~~~~~~~~~~~~~~~OUTPUT here ~~~~~~~~~~~~~~~~~~~~~~~
readTime value is :
02-DEC-05 12.07.53.779328 AM -06:00
value of checkTime :
02-DEC-05 12.07.54.013613 AM -06:00
value of timeDiff : 02-DEC-05 12.07.54.013613 AM -06:00','''YYYY\/MM\/DD:HH24:MI:SS'''))-CAST(TO_DATE('
ERROR at line 2:
ORA-00905: missing keywordYou didn't specify if you want a total time for a portion of a shell script, or the whole script in general. If you only want to know the time of the whole shell script, just reference the linux/unix built-in variable ${SECONDS}. This variable is reset for each PID.
I usually add these lines to the bottom of long running shell scripts (just before an exit code):
~~~~~~~~~~~~~~~~~~~~~~~~~
((TIME = ${SECONDS} / 60))
echo "Script ran for ${TIME} minutes. (${SECONDS} seconds total.)
~~~~~~~~~~~~~~~~~~~~~~~~~
Like I said, ${SECONDS} starts ticking from 0 when you start the script, so no need to export the variable, just reference it. The nice part is that you don't have to bother getting into sqlplus and hit the database. -
ORA-6571 ERROR (PACKAGE PRAGMA의 사용)
제품 : SQL*PLUS
작성날짜 : 1997-06-03
* ORA-6571 Error ( Package Pragma 의 사용 )
=============================================
SQL문 안에서 Stored function을 call하여 사용하는 경우 ORA-6571 error가
발생할 수 있습니다. 기본적으로 stored function이나 procedure, package에서의
DML 문장의 사용은 보장이 되는 기능이나, sql list에서의 stored function의
사용은 몇 가지 제약 조건을 가지고 수행이 가능합니다.
아래의 자료는 ORA-6571 error가 발생하는 원인에 대하여 기술한 자료이며,
stored function을 SQL EXPRESSION에서 사용하는 경우에 대해서만 적용이 되는
사항입니다.
Calling Stored Functions from SQL Expressions
Stored function은 data dictionary에 저장이 되는 user defined pl/sql
function을 의미하며, 하나의 database object로서 해당 database에 connect하는
application에 의해서도 reference될 수 있습니다.
Function에는 2가지 유형이 제공되고 있는데, package 형태(pl/sql package 내
에서 defined된 function)와, standalone function(독립적인 function)이 있
습니다.
pl/sql version 2.0까지는 stored function을 call하는 부분이 procedural
statement에서만 사용이 가능하였으나, pl/sql version 2.1부터는 sql 문 안에서
도 stored function을 call하여 사용이 가능하게 되었습니다.
2.1 version 이상의 pl/sql engine에서는 select 문이나 values, set, where,
start with, group by, having, order by 등과 같은 sql expression에서
function을 call하여 사용하실 수 있습니다.
즉, user-defined function을 built-in sql function(round, length,
months_between ...)과 같은 형태로 사용이 가능하도록 지원이 됩니다.
이러한 sql 문의 확장 지원은 oracle server 내에서 보다 복잡한 data에 대한
분석 작업을 용이하게 하며 data independency를 증가시킵니다.
Sql expression의 내부에서 사용이 되는 function과는 다르게 stored procedure는
statement로서만 call되며 sql expression에서 direct로 call될 수 없습니다.
Calling Syntax
stored function을 sql expression에서 call하고자 하는 경우에는 다음의 syntax
를 사용하시면 됩니다.
[schema.][package.]function[@dblink][(arg[, arg] ...)]
argument를 넘기는 경우에는 positional notation을 사용하여 작업을 수행하셔야
합니다.
Remote oracle database에 있는 standalone function gross_pay를 call하는
경우를 예로 들어보면 아래와 같이 기술할수 있습니다.
SELECT gross_pay@newyork(eenum, stime, otime) INTO pay FROM dual;
Using Default Values
Stored function gross_pay가 DEFAULT 절을 사용하여 2개의 formal parameter를
넘기는 경우의 function creation은 아래와 같이 기술됩니다.
CREATE FUNCTION gross_pay
(emp_id IN NUMBER,
st_hrs IN NUMBER DEFAULT 40,
ot_hrs IN NUMBER DEFAULT 0) RETURN
NUMBER AS
Procedural statement에서 gross_pay function을 call하는 경우에는 항상
st_hrs의 default 값을 accept할 수 있으며, 이는 named notation을 사용하기
때문에 가능합니다.
그러나, sql expression에서는 ot_hrs의 default값을 accept하지 않는다면,
st_hrs의 default값을 accept할 수 없으며, 이는 named notation을 sql
expression에서는 사용할 수 없기 때문입니다.
/* Named Notation */
IF gross_pay(eenum, ot_hrs => otime) > pay_limit THEN . . .
Meeting Basic Requirements
sql expression에서 call 할 수 있는 user-defined pl/sql function은
아래의 기본 조건을 만족하여야 합니다.
1. Stored function이여야 합니다.
pl/sql block이나 subprogram 내에 define된 function은 사용할 수 없습니다.
2. Row function이여야 하며, column (group) function이여서는 안됩니다.
이는 argument로 전체 column의 data를 사용할 수 없기 때문입니다.
3. Function의 모든 formal parameter는 반드시 IN parameter이여야 합니다.
OUT이나 IN OUT parameter는 사용될 수 없습니다.
4. Formal parameter의 datatype은 oracle server internal type (CHAR,
DATE, NUMBER)이어야 합니다.
pl/sql type(BOOLEAN, RECORD, TABLE)은 사용할 수 없습니다.
5. Return type도 반드시 oracle server internal type이여야 합니다.
아래의 stored function은 상기의 조건을 모두 만족하는 function입니다.
CREATE FUNCTION gross_pay
(emp_id IN NUMBER,
st_hrs IN NUMBER DEFAULT 40,
ot_hrs IN NUMBER DEFAULT 0) RETURN NUMBER
AS
st_rate NUMBER;
ot_rate NUMBER;
BEGIN
SELECT srate, orate INTO st_rate, ot_rate
FROM payroll
WHERE acctno = emp_id;
RETURN st_hrs * st_rate + ot_hrs * ot_rate;
END gross_pay;
Controlling Side Effects
Sql 문에서 call되는 stored function을 실행하기 위하여, oracle server는
해당 function의 purity level(function이 side effect로 부터 free한 영역)을
알고 있어야만 합니다.
Side effect는 database table이나 packaged variable에 대한 reference를
의미합니다.
Side effect는 query의 parallelization을 제한할 수 있는데, 이유는
order-dependent한 결과(indeterminate result)나 user session간에 지속적인
값을 유지(not allowed)하는 package state가 요구되는 경우가 발생하기 때문입
니다.
그러므로, 아래에 기술되는 사항은 sql expression에서 call되는 stored
function에 적용되어야 합니다.
1. Function은 database table을 modify해서는 안된다.
(insert, update, delete statement를 사용할 수 없다.)
2. Remote나 parallelized function은 packaged variable의 값을 읽거나
쓸 수(read or write) 없다.
3. Select, values, set 절에서 call되는 function만이 packaged variable의
값을 write할 수 있다.
4. Function은 앞에 기술된 rules를 어기는 또 다른 subprogram을 call할 수 없다.
마찬가지로 앞에 기술된 rule을 어기는 view를 reference할 수 없습니다.
(Oracle은 view에 대한 reference를 function call을 포함하는 stored SELECT
operation 으로 대체합니다.)
Standalone function에 대하여 oracle은 function body를 checking함으로써,
이러한 rule이 적용되도록 합니다.
그러나, package에 대해서는 packaged function body는 hidden이 되며,
package specification만이 visible하기 때문에, specification 부분에
pragma(compiler directive) RESTRICT_REFERENCES를 기술하여야 합니다.
Pragma는 pl/sql compiler에게 database table이나 packaged variable에
대하여 read/write access를 하지 않는다는 것을 기술합니다.
Function body를 compile하는 도중 pragma에 위반되는 내용이 있다면,
compilation error가 발생합니다.
Calling Packaged Functions
Sql expression에서 packaged function을 call하기 위해서는, package
specification에서 pragma RESTRICT_REFERENCES를 기술함으로써 purity level을
선언하여야 합니다.
Pragma는 function declaration 이후에 기술되어야 하는 사항이며, 주어진
function에 대하여 단지 한 pragma만이 기술될 수 있습니다.
Pragma RESTRICT_REFERENCES를 기술하는 syntax는 아래와 같습니다.
PRAGMA RESTRICT_REFERENCES
(function_name, WNDS [, WNPS] [, RNDS] [,RNPS]);
WNDS means "writes no database state" (does not modify db tables)
WNPS means "writes no package state" (does not change the values of
packaged variables)
RNDS means "reads no database state" (does not query database tables)
RNPS means "reads no package state" (does not reference the values of
packaged variables)
어떤 순서로든 기술된 argument를 passing할 수 있으며, WNDS는 반드시
pass되어야 합니다.
아래의 예는 maximum purity level을 선언한 packaged function이며,
database나 package state에 대하여 read나 write를 전혀 수행하지 않는
function입니다.
CREATE PACKAGE finance AS -- package specification
FUNCTION compound
(years IN NUMBER,
amount IN NUMBER,
rate IN NUMBER )
RETURN NUMBER;
PRAGMA RESTRICT_REFERENCES(compound, WNDS, WNPS, RNDS, RNPS);
END finance;
CREATE PACKAGE BODY finance AS -- package body
FUNCTION compound
(years IN NUMBER,
amount IN NUMBER,
rate IN NUMBER)
RETURN NUMBER IS
BEGIN
RETURN amount * POWER((rate/100) + 1, years);
END compound;
-- no pragma in package body
END finance;
이후에 pl/sql block에서 compound function을 call하는 경우에는 아래와
같이 기술될 수 있습니다.
BEGIN
SELECT finance.compound(yrs, amt, rte) -- function call
INTO interest FROM accounts WHERE acctno = acct_id;
Package는 initialization part를 가질 수 있으며, 이는 package body에는
hidden됩니다.
일반적으로 initialization part는 public variable에 대한 initialize
statement를 기술하게 되며, 아래의 예에서는 prime_rate 이라는 public
variable에 대한 예가 기술되어 있습니다.
CREATE PACKAGE loans AS
prime_rate REAL; -- public packaged variable
END loans;
CREATE PACKAGE BODY loans AS
BEGIN -- initialization part
SELECT prime INTO prime_rate FROM rates;
END loans;
Initialization code는 package가 처음 reference되는 경우에 단지 한번만
수행이 되며, 자신의 것이 아닌 database state나 package state를 read나
write를 하게 되면, side effect의 원인이 될 수 있습니다. 더 나아가
package를 reference하는 stored function은 indirect하게 side effect를
발생시킬 수 있습니다. 그러므로, pragma RESTRICT_REFERENCES를 사용하여
initialization code에 대한 purity level을 명시적으로 선언을 하거나
암시해줄 수 있어야 합니다.
Initialization code에 대한 Purity level을 선언하기 위하여, pragma를
사용하여 작업을 하실 수 있으며, function name을 package name으로
대체하여 기술하시면 됩니다.
Package specification 부분에 기술되는 pragma는 다른 user들에게도
open되어 있는 것이기 때문에, package를 reference 하는 user들은
restriction에 대한 사항을 보게 되며, 해당하는 제약 사항을 따르게 됩니다.
사용되는 syntax는 다음과 같습니다.
PRAGMA RESTRICT_REFERENCES (
package_name, WNDS [, WNPS] [, RNDS] [, RNPS]);
Argument의 의미는 앞에서 기술된 사항과 동일합니다.
아래의 예에서 보면, initialization code는 database state에 대한 read와
package state에 대한 write를 수행합니다. 그러나 WNPS를 선언할 수 있는데
이는 자기 자신의 package state만을 write하는 code이기 때문에 선언이 될
수 있습니다.
만약 public variable prime_rate이 다른 package에 포함되어 있는
것이라면, WNPS는 선언될 수 없습니다.
CREATE PACKAGE loans AS
PRAGMA RESTRICT_REFERENCES (loans, WNDS, WNPS, RNPS);
prime_rate REAL;
END loans;
CREATE PACKAGE BODY loans AS
BEGIN
SELECT prime INTO prime_rate FROM rates;
END loans;
Pragma를 인식함으로 해서 oracle은 initialization code의 purity level을
알 수 있습니다.
( pragma에 의하여 선언된 rule을 위배하여 생성될 수 없기 때문 )
Avoiding Problems
Sql expression에서 packaged function을 call하기 위해서는 pragma
RESTRICT_REFERENCES를 사용하여 function의 purity level을 선언하여야
합니다.
그러나 package가 initialization part를 가지고 있다면, pl/sql
compiler는 function에 허용되는 가장 높은 purity level을 선언하도록
허용하지 않습니다. 결과적으로 function을 remote에서 수행하거나,
parallel하게 또는 sql 절에서 사용할 수 없도록 제한됩니다.
이러한 사항은 packaged function이 package initialization code보다
purity level이 더 높은 경우에 발생하며, 기억하여야 할 것은,
package가 처음 reference되는 때에 initialization code가 실행된다는
사항입니다. 처음 reference하는 것이 function call인 경우,
initialization code에 의하여 부가적인 side effect가 발생하는
원인이 됩니다.
이러한 사항은 initialization code가 function의 purity level보다
낮은 경우에 발생하는 사항입니다.
이러한 문제를 해결하기 위해서는 package initialization code를
subprogram으로 옮겨
주어야 합니다. 이러한 방식으로 변경하는 경우에는 package가 reference
되는 중에 implicitly하게 code를 run하지 않고 explicitly하게 code를
run하게 되며, 이는 packaged function에 영향을 주지 않습니다.
Name Precedence
database column과 argument를 가지지 않는 function이 동일한 이름을
가진다면, sql문안에서 database column이 우선순위를 가지게 됩니다.
CREATE TABLE stats (rand_num NUMBER, . . .);
CREATE FUNCTION rand_num
RETURN NUMBER AS . . . .
위와 같은 상황에서 아래의 sql문을 사용하는 경우 column rand_num을
참조하게 됩니다.
SELECT rand_num INTO start_val FROM stats WHERE . . .
이 경우 stored function rand_num을 사용하기 위해서는 schema를
기술해주어야 합니다.
SELECT scott.rand_num INTO start_val FROM stats WHERE . . .
Overloading
Pl/sql에서는 packaged function에 대해서 overload를 허용합니다.
(standalone은 허용되지 않음) 다시 말하면 넘겨주는 argument가 갯수나,
순서, datatype등이 다르다면, 서로 다른 function에 대해서도 동일한
이름을 사용할 수 있습니다.
그러나 RESTRICT_REFERENCES pragma는 단지 한 function에 대해서만
적용이 되며, 가장 가까운 곳에 선언된 function에 대하여 적용이 됩니다.
아래의 예에서는 두번째 function에 pragma 선언이 적용됩니다.
CREATE PACKAGE tests AS
FUNCTION valid ( x NUMBER)
RETURN CHAR;
FUNCTION valid ( x DATE)
RETURN CHAR;
PRAGMA RESTRICT_REFERENCES (valid, WNDS);You will need to investigate/resolve these errors first before making a decision
2 . ORA-00406: COMPATIBLE parameter needs to be 11.0.0.0.0 or greater ORA-00722:
1 . ORA-00722: Feature "Virtual columns" ORA-06512: at line 31
1 . ORA-00722: Feature "Virtual columns" ORA-06512: at line 43
1 . ORA-06512: at line 31
1 . ORA-06512: at line 43 -
SQL Error: ORA-29913: error in executing ODCIEXTTABLEOPEN callout
Dear Friends,
I executed the following stmsts:
1)CREATE OR REPLACE DIRECTORY TEST_DIR AS 'd:\mydata';
2)GRANT READ, WRITE ON DIRECTORY TEST_DIR TO wonders_mumbai1;
3)CREATE TABLE ext_tab18 (
old_cust VARCHAR2(8),
new_cust VARCHAR2(8)
ORGANIZATION EXTERNAL (
TYPE oracle_loader
DEFAULT DIRECTORY TEST_DIR
ACCESS PARAMETERS (
RECORDS DELIMITED BY NEWLINE
BADFILE TEST_DIR:'bad-upload.bad'
LOGFILE TEST_DIR:'log_upload.log'
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"'
MISSING FIELD VALUES ARE NULL
REJECT ROWS WITH ALL NULL FIELDS
(old_cust,new_cust))
LOCATION ('datafile1.csv')
REJECT LIMIT 0
NOMONITORING;
4)SELECT * FROM ext_tab18;
1 -3 execute successfully.
4 throws up the error:
Error starting at line 1 in command:
SELECT * FROM ext_tab18
Error report:
SQL Error: ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-04063: unable to open log file log_upload.log
OS error The system cannot find the file specified.
ORA-06512: at "SYS.ORACLE_LOADER", line 19
29913. 00000 - "error in executing %s callout"
*Cause: The execution of the specified callout caused an error.
*Action: Examine the error messages take appropriate action.
What is to be done?Hi,
Yes if I put it on the server it works.
But if I put the file on the client in a shared folder and put the ip address as below:
10.97.140.59\mydata
it doesn't work.
So it seems that this will work if the file is on the server and not on any client.
If that be the case then it is a definite disadvantage.
thanks for ur reply. -
SQL Error: ORA-29902: error in executing ODCIIndexStart() routine
I am running a SDO_RELATE operation on 2 geometries from 2 different tables. Spatial indexes are already created and the tables are also versioned.
Below is the spatial meta data for both the geometries in user_sdo_geom_metadata table:
DIMINFO is :
MDSYS.SDO_DIM_ELEMENT(MDSYS.SDO_DIM_ELEMENT(Easting,0,700000,0.001),MDSYS.SDO_DIM_ELEMENT(Northing,0,1300000,0.001),MDSYS.SDO_DIM_ELEMENT(Height,-100,2000,0.001))
SRID is 27700
When I use SDO_RELATE or ADO_ANYINTERACT on both the geometires, i am getting the below error.
Error report:
SQL Error: ORA-29902: error in executing ODCIIndexStart() routine
ORA-13243: specified operator is not supported for 3- or higher-dimensional R-tree
ORA-06512: at "MDSYS.SDO_INDEX_METHOD_10I", line 333
29902. 00000 - "error in executing ODCIIndexStart() routine"
*Cause: The execution of ODCIIndexStart routine caused an error.
*Action: Examine the error messages produced by the indextype code and
take appropriate action.
Could you please let me know what should be the root cause for this issue?Hi
Have you checked this posting?
Re: ORA-13243
Luc -
ORA-06550 error while executing Dynamic Sql
EXECUTE IMMEDIATE 'BEGIN :out := ' || lv_formula || '; END;' using out RESULT ;
here lv_formula:= ((capcost * rate / 100) + (ob + (ob * interestrate / 100)))
lv_formula is varchar2(360);
and capcost,rate,ob & interestrate are my column names . Here I m declaring variables same as these columns and datatype is number.
I am not getting any compilation error. syntax is correct
while executing this sql i m getting ora-06550.
can any one help me for resolving this error.
Thanks In Advance
hoping for more resposeThanks Billy for your response,
but i still didn't get my desired solution so i am pasting my whole plsql code here. so that u can get better picture.
/* Formatted on 2010/11/22 15:23 (Formatter Plus v4.8.5) */
PROCEDURE xb (
l_refno IN VARCHAR2,
l_billtyp IN VARCHAR2,
infor IN VARCHAR2,
aresult OUT NUMBER
IS
--A NUMBER:=10; B NUMBER :=5;
lv_formula VARCHAR2 (270); --:=(A+B)*2+5;
l_agtmnt VARCHAR2 (18);
l_type VARCHAR2 (2);
RESULT NUMBER;
refno afxbrmst.refno%TYPE;
billtyp afxbrmst.billtyp%TYPE;
ob afxbrmst.ob%TYPE;-- := 45283;
status afxbrmst.status%TYPE -- := 0;
dueamt afxbrmst.dueamt%TYPE -- := 0;
duedate afxbrmst.duedate%TYPE;
frequency afxbrmst.frequency%TYPE;
lastrevrate afxbrmst.lastrevrate%TYPE -- := 0;
penaltyamt afxbrmst.penaltyamt%TYPE -- := 0;
accounted afxbrmst.accounted%TYPE;
lastbillraised afxbrmst.lastbillraised%TYPE;
noofstaff afxbrmst.noofstaff%TYPE;
items afxbrmst.items%TYPE;
area afxbrmst.area%TYPE;
LENGTH afxbrmst.LENGTH%TYPE -- := 0;
interest afxbrmst.interest%TYPE -- := 0;
capcost NUMBER; afxbrmst.capcost%TYPE; :=1;
-- := 1509432;
periodfrom afxbrrate.periodfrom%TYPE;
periodto afxbrrate.preiodto%TYPE;
rcsrate afxbrrate.rcsrate%TYPE -- := 0;
length_area afxbrrate.length_area%TYPE;
rate afxbrrate.rate%TYPE --:= 0;
-- :=3;
erate afxbrrate.erate%TYPE -- := 0;
feamount afxbrrate.feamount%TYPE -- := 0;
interestrate afxbrrate.interestrate%TYPE -- := 0;
-- :=12;
fiamount afxbrrate.fiamount%TYPE --:= 0;
penaltyrate afxbrrate.penaltyrate%TYPE -- := 0;
l_ob afxbrmst_test.ob%TYPE -- := 0;
l_capcost afxbrmst.capcost%TYPE -- := 0;
raise_application_trigger EXCEPTION;
inti INTEGER;
BEGIN
--break;
lv_formula :=
TO_NUMBER ((capcost * rate / 100) + (ob + (ob * interestrate / 100)));
--infor;
l_agtmnt := l_refno;
l_type := l_billtyp;
BEGIN
SELECT a.refno, a.billtyp, a.ob, a.status, a.dueamt, a.duedate,
a.frequency, a.lastrevrate, a.penaltyamt, a.accounted,
a.lastbillraised, a.noofstaff, a.items, a.area, a.LENGTH,
a.interest, a.capcost
INTO refno, billtyp, ob, status, dueamt, duedate,
frequency, lastrevrate, penaltyamt, accounted,
lastbillraised, noofstaff, items, area, LENGTH,
interest, capcost
FROM afxbrmst_test a
WHERE billtyp = l_type AND refno = l_agtmnt;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
NULL;
END;
BEGIN
SELECT b.periodfrom, b.preiodto, b.rcsrate, b.length_area, b.rate,
b.erate, b.feamount, b.interestrate, b.fiamount, b.penaltyrate
INTO periodfrom, periodto, rcsrate, length_area, rate,
erate, feamount, interestrate, fiamount, penaltyrate
FROM afxbrrate b
WHERE billtype = l_type;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
NULL;
END;
EXECUTE IMMEDIATE 'BEGIN :out := ' || lv_formula || '; END;'
USING OUT RESULT; --USING OUT RESULT;
aresult := RESULT;
END;
-- Procedure
here i m passing the parameter through my form builder and calling this procedure.
can you tell me where i am making wrong
Thanks again
Maybe you are looking for
-
Apple is suppose to be the pinnacle of usability and, yet, I want to throw my new IPhone 4s as far as I can and watch is smash into a million pieces on concrete. Seriously, I've already got three things that irritate the **** out of me. First, there
-
Want to share everything but messages, FaceTime and phone calls
My wife and I share our calendars and contacts across our devices. We each do have a separate Apple ID. However we've been sharing with the first main Apple ID all along including iTunes, iTunes Store and Apple Store. Now on iOS 8 her iPhone / iPad
-
Problems with file content conversion
Hi, in my scenario (Z-IDOC - XI - File) I send 2 segments to the XI. L061 18000 DE 0101 23236318 050605 EUR L061 87000 DE 0101 050605 EUR In the second segment there is no XBLNR !! IDOC: ZFIBUCH Segment: L061 Fields:
-
Hi everyone! This is my last try to fix my Blackberry... Let me explain: About a month ago, all of a sudden, my Blackberry stopped receiving and sending emails. Everything else works perfectly, I can send Whatsapp, BBM, use the internet normaly, but
-
IPhone 3G and Outlook 2007 sync Vista x64
Hi, I pre-ordered two iPhone 3G a week ago (still not received them) and then went online to read user opinions about it. and, honestly, the scared me. First, battery life. I'm Samsung SCH-i760 (Verizon) smartphone user and I'm pretty happy with it.