Oracle packages & performance
can anybody give me a clear cut idea, whether performance of oracle changes or remains same when a oracle package body created with forward declaration of sub programs than with out forward declaration.
Ex.
create package a as
procedure b;
procedure c;
end a;
create package body a as
procedure x;
procedure y;
procedure x is
begin
end x;
procedue b is
begin
procedure x;
end b;
Could you give more explainations
Similar Messages
-
Optional Parameter - Oracle Package Throws an Error
Hi there,
I have an Oracle Package & it has a stored procedure with optional parameter. The calling code is in ColdFusion.
When I run my webpage the Oracle throws below error.
" [Macromedia][Oracle JDBC Driver][Oracle]ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'GET_CONTRACT_BY_DYN_SQL' ORA-06550: line 1, column 7: PL/SQL: Statement ignored "
Calling Code (ColdFusion)
<cfstoredproc procedure="CONTRACTS_PKG.GET_CONTRACT_BY_DYN_SQL" datasource="#REQUEST.dsn#">
<cfprocparam cfsqltype="CF_SQL_INTEGER" type="in" value="1" variable="P_CONTRACTID">
<cfprocresult name="qDataDynSQL" resultset="1">
</cfstoredproc>
<br>Dynamic SQL Query:
<cfdump var="#qDataDynSQL#" label="Dynamic SQL Query">
Oracle Package
create or replace
PACKAGE CONTRACTS_PKG AS
TYPE T_CURSOR IS REF CURSOR;
PROCEDURE GET_CONTRACT_BY_DYN_SQL(P_CONTRACTID IN NUMBER, P_COLS IN VARCHAR2 DEFAULT '*', IO_CURSOR IN OUT T_CURSOR);
END CONTRACTS_PKG;
create or replace
PACKAGE BODY CONTRACTS_PKG AS
-- Get Contract Using Dynamic SQL
PROCEDURE GET_CONTRACT_BY_DYN_SQL(P_CONTRACTID IN NUMBER, P_COLS IN VARCHAR2 DEFAULT '*', IO_CURSOR IN OUT T_CURSOR)
IS
V_CURSOR T_CURSOR;
V_SQL VARCHAR2(200);
BEGIN
IF p_contractid > 0 THEN
V_SQL := 'SELECT '|| P_COLS || ' FROM CONTRACTS WHERE contract_id = ' || P_CONTRACTID ;
ELSE
V_SQL := 'SELECT '|| P_COLS || ' FROM CONTRACTS';
END IF;
OPEN V_CURSOR FOR V_SQL;
IO_CURSOR := V_CURSOR;
END GET_CONTRACT_BY_DYN_SQL;
END CONTRACTS_PKG;
Does anyone knows why it throws an error? As you can see in the package header & body the parameter P_COLS has the default value as '*'.
Looking forward to hear from someone.
Thanks,
Hitesh Patel931198 wrote:
I have an Oracle Package & it has a stored procedure with optional parameter. The calling code is in ColdFusion.
When I run my webpage the Oracle throws below error.Never mind the error - your approach is most definitely a candidate for Oracle WTF.
Nothing sane about this approach. Especially the decision not to use bind variables and slowing down cursor processing significantly by burning a lot more CPU cycles on hard parsing and fragmenting the SQL Shared Pool in the process.
Why not used MS Access instead? It is far more suited as a mickey mouse database for a goofy application?
Why am I badmouthing your approach to Oracle? Because that is exactly the primary cause, the #1 reason, for poor Oracle performance and run-time problems dealing with Shared Pool fragmentation. It is something that many Oracle experts blog about, talk about, write about. It is addressed in numerous books, Oracle documentation, and even Oracle Support Notes.
And despite the amount of information available on how to get the basics rights in using Oracle... this approach you are pursuing still refuses to die. So it deserves to be beaten with a lead pipe when it rears its ugly head here in this forum.. -
Kindly answer me the questions below
1) Advantages of packages over individual procedures( other than modularity,better performance,information hiding)
2) why do we want to create oracle package spec without body.? what is the purpose of creating the package without body?
Kindly give ur valuable suggestions..
Soraclehema wrote:
Kindly answer me the questions below
1) Advantages of packages over individual procedures( other than modularity,better performance,information hiding)To break dependencies. You can create or replace a package body, without invalidating objects that depend upon this package. Because those objects will depend on the package specification.
>
2) why do we want to create oracle package spec without body.? what is the purpose of creating the package without body?To facilitate team-development. Once the 'interface' of packaged objects has been agreed upon, the package specifications can already be created. Enabling other team developers to start building objects that depend upon them. While at the same time the implementation, the package body, is still under development.
Or, to hold global persistent variables. I.e. to create state-only packages. -
Using Oracle Packages in Oracle BI EE
I am trying to replicate old Discoverer reports in Oracle BI EE. In the old Discoverer reports, they would include the package and function information in the SELECT statement of the SQL. When I try to import the database information in BI EE, I can only get table and view information, not the packages. How do you access and use Oracle packages in BI EE? Thanks in advance for any help you may be able to provide.
If you have OBIEE 10.1.3.3 OBIEE you can use BI built-in EVALUATE function to call user-defined functions in database.
This function is intended for scalar and analytic calculations.
Syntax: EVALUATE('DB_Function(%1)', <Comma separated Expression>)
Example: SELECT e.lastname,sales.revenue,EVALUATE('dense_rank() over(order by %1 )',sales.revenue) FROM sales s, employee e; -
Crystal report hangs when calling oracle package
hi i have a oracle package that calls a proceadure, if i test this package in PLSQL developer it compiles and i get sensible results
this package has been designed using a ref type cursor to be called from crystal reports. it primary objective when the report is run, is to use File util to output data to an xml file.
when i run this from crystal reports it locks crystal reports up, and dosent output a file.
any ideas why crystal is hanging?
crystal DB call
{CALL Enhanced_Pharos_Report.run_report
(NVL({?a_channel_id},0),{?b_on_date})}
package
create or replace package UKTV_PHAROS_EXPORT_RPT
-- Author : WARDLJ01
-- Created : 03/04/2006 12:25:03
-- Purpose : export xml for pharos voiceovers
-- Public type declarations
AS
TYPE result_set_type IS REF CURSOR;
PROCEDURE run_report
(main_cursor IN OUT result_set_type,
V_CHANNEL_ID NUMBER,
V_ONDATE DATE);
end ;--UKTV_PHAROS_EXPORT_RPT;
package body
create or replace package body UKTV_PHAROS_EXPORT_RPT AS
PROCEDURE run_report
(main_cursor IN OUT result_set_type,
V_CHANNEL_ID NUMBER,
V_ONDATE DATE)
is
BEGIN
OPEN main_cursor FOR
-- Passess the parameters back to the cursor - which passes them back to the Crystal Report output
SELECT V_CHANNEL_ID, V_ONDATE from DUAL;
-- This is a procedure that calls FILE_UTL to export the data.
UKTV_PHAROS_Export(V_CHANNEL_ID, V_ONDATE);
END;
end;
Proceadure
create or replace procedure uktv_own.UKTV_Pharos_Export(V_CHANNEL_ID number, V_ONDATE date) is
l_output utl_file.file_type;
p_filename varchar2(30);
V_DETAIL_id varchar2(100);
V_MEDIA_ID varchar2(150);
V_REQUIRED varchar2(50);
V_SCRIPT varchar2(4000);
V_DEL_DATE varchar2(100);
V_FULLMEDIA_ID varchar2(500);
V_START_TIME varchar2(100);
V_DURATION varchar2(100);
V_DATE varchar2(100);
V_CHANNEL varchar2(40);
V_LOGO_NAME varchar2(250);
Cursor VO_CURSOR
IS
select event_voiceover.detail_id, vo_media_id, vo_required, vo_script, vo_del_date, full_media_id,
event.start_time, event.duration, event.on_date, event.channel_id, logo.logo_name
from event_voiceover,
onair.event, onair.event_technical_data,
onair.logo
where event_voiceover.detail_id = event.detail_id
and event_technical_data.event_technical_data_id = event.event_technical_data_id
and event_technical_data.content_id = logo.logo_id and
event.channel_id = V_CHANNEL_ID and
vo_required = 500004580 and
event.on_date = V_ONDATE;
begin
p_filename :='voice_overs.xml';
l_output := utl_file.fopen ('PHAROS_DIR', p_filename, 'w' );
OPEN VO_CURSOR;
utl_file.put ( l_output,'<Voice_Overs>');
Loop
FETCH VO_CURSOR INTO V_DETAIL_id, V_MEDIA_ID, V_REQUIRED,V_SCRIPT, V_DEL_DATE, V_FULLMEDIA_ID, V_START_TIME, V_DURATION, V_DATE, V_CHANNEL, V_LOGO_NAME;
EXIT WHEN VO_CURSOR%NOTFOUND
OR VO_CURSOR%ROWCOUNT = 10000;
utl_file.put( l_output, '<DETAIL_ID>');
utl_file.put( l_output, V_DETAIL_ID);
utl_file.put( l_output, '</DETAIL_ID>');
utl_file.put( l_output, '<MEDIA_ID>');
utl_file.put( l_output, V_MEDIA_ID);
utl_file.put( l_output, '</MEDIA_ID>');
utl_file.put( l_output, '<REQUIRED>');
utl_file.put( l_output, V_REQUIRED);
utl_file.put( l_output, '</REQUIRED>');
utl_file.put( l_output, '<SCRIPT>');
utl_file.put( l_output, V_SCRIPT);
utl_file.put( l_output, '</SCRIPT>');
utl_file.put( l_output, '<DEL_DATE>');
utl_file.put( l_output, V_DEL_DATE);
utl_file.put( l_output, '</DEL_DATE>');
utl_file.put( l_output, '<FULLMEDIA_ID>');
utl_file.put( l_output, V_FULLMEDIA_ID);
utl_file.put( l_output, '</FULLMEDIA_ID>');
utl_file.put( l_output, '<START_TIME>');
utl_file.put( l_output, V_START_TIME);
utl_file.put( l_output, '</START_TIME>');
utl_file.put( l_output, '<DURATION>');
utl_file.put( l_output, V_DURATION);
utl_file.put( l_output, '</DURATION>');
utl_file.put( l_output, '<ONDATE>');
utl_file.put( l_output, V_DATE);
utl_file.put( l_output, '</ONDATE>');
utl_file.put( l_output, '<CHANNEL_ID>');
utl_file.put( l_output, V_CHANNEL);
utl_file.put( l_output, '</CHANNEL_ID>');
utl_file.put( l_output, '<LOGO_NAME>');
utl_file.put( l_output, V_LOGO_NAME);
utl_file.put( l_output, '</LOGO_NAME>');
utl_file.new_line ( l_output);
end loop;
utl_file.put ( l_output,'</Voice_Overs>');
utl_file.fclose(l_output);
end UKTV_Pharos_Export;Hi yes the package uses fileutil to output a file,
the report user has permission over the file util output directory.
I have previously used this method to generate rpt, and other output files in parelell.
thanks
james -
Sending an Email from within an Oracle Package
Hi,
I am trying to send an email from within a Oracle package Body. The code i have to do this is as follows: -
PROCEDURE send_mail(sender_in IN VARCHAR2,
recipient_in IN VARCHAR2,
date_from_in IN VARCHAR2,
date_to_in IN VARCHAR2) IS
-- Procedure to send e-mail
mailhost VARCHAR2(30) := '192.168.2.6';
crlf VARCHAR2(2) := CHR(13)||CHR(10);
--message VARCHAR2(32767);
message LONG;
mail_conn utl_smtp.connection;
reply VARCHAR2(512);
BEGIN
mail_conn := utl_smtp.open_connection(mailhost, 25);
message := 'Date: '||TO_CHAR(SYSDATE, 'DD-MON-YY HH24:MI:SS')||crlf||
'From: <'||sender_in||'>'||crlf||
'Subject: ''Holiday Request'||crlf||
'To: '||recipient_in||crlf||
utl_smtp.helo(mail_conn, mailhost);
utl_smtp.mail(mail_conn, sender_in);
utl_smtp.rcpt(mail_conn, recipient_in);
utl_smtp.data(mail_conn, message);
utl_smtp.quit(mail_conn);
EXCEPTION
WHEN others THEN
RAISE;
END send_mail;
end holidays;
I have one question though. I am getting a ORA-29278 SMTP Transien Error: 421 Service Nota Available Error. I think this may be due to the 'Mailhost' value I have given in the above code. I have been informed that this should be the ip address of the mail server used or the ip address of the machine if it is being run locally. What would i need to put in here if i wish for an email to be sent from one hotmail address to another for example?
Any help would be much appreciated!
Thanks!
Darrenhi
The funnier part is that
u can actually type in the sender's email id irrespective of the mail host used
Like @hotmail.com,@yahoo.com etc.
The receiver will get the mails from the email id that u wrote .
The problem u r facing is becoz of the incorrect mail host server ip address
Try to get in touch with the network admin for the mail server ip address
other way is
get the name it would be like
smtp.domain name .
hope that helps -
How to include an Oracle Package in ODI Package
Hi All,
I have to include an Oracle Package into an ODI Package.
Is this possible. If yes, please guide me through.
Reagrds
ManojHi John,
Thanks for the reply. I ll implement that and will let you know.
Can you please look at the following as well.
How to solve this major issue.
Thanks
Manoj. -
Oracle package invalidate problem with the jdbcOracleConnectionCacheImpl ()
Hi all,
I am using the OracleConnectionCacheImpl(); to Create the Oracle connection pool (OracleConnectionCacheImpl class)
In my application i am calling the oracle stored procs.
(DB environment :Oracle 9i)
to call those stored proc i used the Prepared statements.
All the requests are calling the same java bean to invoke the same package.
when ever the changes occured in the db level,(it means if that package is invalid. i.e when ever the db refreshes occured), all the requests are geting oracle error.
after the oracle package become valid.. still i am geting the oracle errors.
it should not happen, because stored proc is in valid state.
if we restart our adapter or java service then we are geting the proper responses.
we don't know when the db problems occurs, when it will be solve
can any one help me to make my application stable
kindly help me to get underastand the behaviour of our java code and the jdbc behaviour.
if any one didn't understand the above description i can mail you the code what i am using..
Thanks in advance
RajThotaA regular Oracle database environment comes with several mandatory userids. These include SYS and SYSTEM. SYS 'owns' all details of the database and SYSTEM is the 'super DBA'. These are database userids, not operating system userids.
I suspect the repository wizard wants to access the SYSTEM userid to be able to create a new schema (equivalent to 'database' for other vendors) within the Oracle environment.
In older versions of Oracle, the default SYSTEM password was 'MANAGER'. These days, any security conscious DBA will have changed that quickly, but ... -
Problem with oracle packages CREATE PACKAGE some packagename in MaxDB
Hi All,
I am having Problems in Creating Packages from MaxDB ..Does MaxDB supports the CREATE PACKAGE <some packagename>concept ? if so please help me how to achieve in creating packages ..
My sample Oracle package Creation is as follows:
CREATE OR REPLACE PACKAGE BODY acs
AS
FUNCTION add_user (
user_id IN users.user_id%TYPE DEFAULT NULL,
object_type IN acs_objects.object_type%TYPE DEFAULT 'user',
creation_date IN acs_objects.creation_date%TYPE DEFAULT sysdate,
creation_user IN acs_objects.creation_user%TYPE DEFAULT NULL,
creation_ip IN acs_objects.creation_ip%TYPE DEFAULT NULL,
) RETURN users.user_id%TYPE
IS
v_user_id users.user_id%TYPE;
v_rel_id membership_rels.rel_id%TYPE;
BEGIN
v_user_id := acs_user.new (user_id, object_type, creation_date,
creation_user, creation_ip, email, ...
RETURN v_user_id;
END;
END acs;
show errors Can you Please Explain me how to write the same Package in MaxDB?
Thanks & Regards,
Shanmukh
Edited by: shanmukh babu on May 16, 2008 10:11 AMHi Shanmukh,
MaxDB does not have packages like you'll find them in Oracle.
But you can define your own functions and procedures.
From the code-example you posted, I would say that a procedure will do it ...
I suggest that you first read the documentation on procedures [CREATE DBPROC Statement|http://maxdb.sap.com/doc/7_6/a7/41ee11605911d3a98800a0c9449261/frameset.htm]
There you'll also find an example in the Tutorial section.
Be aware that the procedural capabilities of MaxDB are far less enlarged as in Oracle - but they do exist and work in their realm.
So porting a full PL/SQL application layer to MaxDB procedures may turn out to be quite difficult and/or not the best choice at all.
KR Lars -
Oracle 10G Performance Tuning Documents
Hi all
Can any one tell where can I get the oracle 10G Performance Tuning materials(PDF),Documents.
Thanks in advancehttp://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14211.pdf
-
Execute Oracle Package Function call from FORTE
Has anyone EVER successfully execute an Oracle Package Function call from FORTE
via " sql execute procedure "?
Here's my question, I am able to execute a stored procedure but hasn't figured
out a way to execute a function which defined in a package. The syntax goes
like this: sql execute procedure <PackageName>.<FunctionName> ( input
input_parm, output output_parm). If anyone EVER successfully execute a
function, please let me know, thanks.You'll need to provide a column alias for the function call:
select func(val) as alias from dual -
Subquery for inserting doesn't work in Oracle package
I have experienced a very strange scenario while inserting data inside a Oracle package.
I have two tables:
- table "A"
Columns: "ID", "Value1", "...."
- table "A_Backup", which contains backup data for table A. It has one more column "BATCH_NUMBER" than table A
Columns: "BATCH_NUMBER", "ID", "Value1", "...."
I created following procedure in a package to backup data from table "A" to "A_Backup".
procedure proc_backup (v_id in number) is
declare
v_batch_number varchar2(20);
begin
/** generate a batch number using system date */
select 'BATCH' || to_char(sysdate, 'YYYYMMDDHH24MISS') into v_batch_number from dual;
/** insert Batch_NUMBER + data from A into A_BACKUP */
insert into A_BACKUP (select v_batch_number, id, value1, ... from A where A.id = v_id);
end proc_backup;
When I debug the procedure, it will not insert any data into A_BACKUP. Apparently, there are some data in table "A" meets criteria "A.id = v_id".
The strange thing: If I create same procedure. But this time I didn't put procedure inside the package, insert query will work.
Please help, I have spent a couple of days on this and never make it work. I also tried cursor, it doesn't work either. It seems Oracle package doesn't support "virtual table" (subquery in insert) or whatever you call it.Welcome to the forum!
Whenever you post provide your 4 digit Oracle version (result of SELECT * FROM V$VERSION).
I don't see any package or test code that calls the procedure or error messages or results from any procedure calls.
You say you have a problem with a package but don't post the package version of the code you are having a problem with.
How is anyone supposed to find a problem in code that you don't post? And when you post use \ tags as discussed in the FAQ. -
Hi,
We are using Oracle Express 6.3.2 & Oracle 8.1.5 for a decision
support system that we are building.
We are using a server with 2GB RAM, Dual CPU( 550MHz) along with
more than 100 GB HDD.The OS being used is Windows NT enterprise
edition server 4.0.On which both Oracle Relational database and
Express express server resides.
The building of multi-dimensional database(MDDB) doesn't take
time, we are using around 9 dimensions with total data in MDDB
being in the range of 5- 10 Lakhs records.The building time is
about 3 minutes.
However, the running of an application(XPJ) based on the MDDB
takes lot of time. The report takes about 2 Minutes to appear
and situtation is even worse in what-if analysis kind of
reports!.The MDDB is being accessed from Windows NT Client
workstation 4.0 with 128 MB RAM.
We have read Oracle Express Performance Tuning and Database
Design Guide which is available from both Oracle Technology
Network (technet.oracle.com) and Metalink, however it doesn't
seem to be of much help.The sparsity etc. have been taken care
of by us.
CAN ANYBODY PROVIDE ASSISTANCE ON THIS ISSUE OR IS IT NORMAL
THING TO EXPECT FROM ORACLE EXPRESS????...., .Request someone to
respond to this issue, as it very urgent & bothersome to us.
ThanksDear Friend,
I am trying to configure reports for express data and in this regard I have done the following :
1.Machine A having reports 9i Developer suite Release 2 and Pluggable Express Connection Editor installed on Windows 2000 professional.
2.Machine B having which Express Server 6.3.4 installed on Windows 2000 professional.
3.In Machine A created user OESDBA with Administrator privilige.
In the reports I am able to connect to the Express Server and attach the database and choose the measure.Once all the other steps are done I am able to print the data on the reports.
But if I use a parameter form in which I give the HOST,USER and PASSWORD then substitute the same in the express_server parameter value in the AFTER PARAMETER FORM trigger block then the report gives an error saying that
Express query contains incorrect,missing or damaged information.
How to solve this error ?
Can you please help.
Regds,
Ramakrishnan
[email protected] -
Using Oracle package variables in JDBC.
Can anybody know how we can use Oracle Package variable in Java/JDBC?
I am using a insert trigger on a table which will initialize the login user
from a package variable.In my log4j configuration file, while inserting data into this table, I am updating the user with my current user. But the insert statement is not identifying the user and it is inserting null.
PLease let me know.Siva,
You said:
It is not inserting the user in the tableI see no table, here. Only a variable in a PL/SQL package.
You also said:
But the same is working in Oracle.Do you mean in SQL*Plus?
Siva, try to forget how you are doing it, and tell me what you are trying to do.
Do you have some UPDATE_USER column in your database tables where you record the username of the person who did the operation?
Are you trying to write a trigger that populates this column?
If so, then all you need is something like:
create or replace trigger MY_TRIG
after insert or update
on MY_TABLE
for each row
begin
:new.UPDATE_USER := user;
end;Good Luck,
Avi.
P.S. By the way, what has this to do with OC4J? -
Oracle apps performance tunning
Hey
could u any one tell me where i will get the Oracle Apps Performance
Tunning on Module wise like OM/AP/AR.
how to verify that my oracle Apps[11.5.10] instance running fine on linux based !!
i need check list Oracle Apps Performance !!best would be to start with http://docs.oracle.com/cd/E11882_01/server.112/e16638/toc.htm
Regards
Karan
Maybe you are looking for
-
Storage location not getting determine in Sales order
Hello All, Storage location not getting determined in SO, every time when i update picking i have to manually enter the storage location. I saw few of the response in the SCN but one thing i noticed in my system was, when i enter OVLQ i don't see OR
-
DVD ROM is not working on Satellite P300
Im running Vista Home premium and my DVD drive (TS-L633A) is not working on a Satellite P300-18M when I check in device manager the dvd has a '!' next to it and a error message of 'Windows cannot start this hardware device because its configuration i
-
code ADAPTER.JAVA_EXCEPTION /code
hi everybody, iam doing the scenario soap to file while iam testing the scenario iam getting the following error .. <!see the documentation> <SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP:Body> <SOAP:Fault>
-
Newbie Bridge CS4 Workspace disappeared
I started Bridge CS4 and the workspace didn't show. I think the last time it was closed unproperly. I purged the cache folders as well as the last workspace how it opened and the workspace still doesn't show. Does someone have any solutions as to how
-
Why is my migration assistant frozen?
So I just bought I new 13 Mbps and i started to do the migration assistant to migrate my data from my old computer to the new one. It started to do it and I left it and went to bed but then when I got up in the morning I went to check it and I could