Administering Stored Procedures and Packages
I've read about WRAP utility but I don't know exactly what's it about. Here you are what ýI've read:ý
The code used to create the procedure ,package ,or function is available in the dictionary ýviews DBA_Source ,All_Source,and user_source except when you create them with the ýWRAP utility .the WRAP utility generates encrypted code, which only the Oracle server ýcan interpret .ý
does any one have any idea .
Thanks in advance
Generally, one uses the WRAP utility when
- You are delivering code to a third party
- You want to ensure that the third party isn't able to decompile your code.
If you built a CRM application with stored procedures and packages and you started selling that commercially, for example, you would use the WRAP utility to ensure that competitors couldn't reverse engineer your code and see how you did things.
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC
Similar Messages
-
Oracle stored Procedure and Packages in CR4E
Hi,
I want to use Stored Procedure in CR4E. I don't know how to use Stored Procedures and packages in Crystal Reports for Eclipse. In the data source explorer I can only see the Tables, Views and Stored Procedures but not packages from my Schema and when I can only drag & drop the Tables and Views into the Field Explorer, I can't drag & Drop the Stored Procedures.
I managed to attached the stored procedure from CR studio. I opened the report in CR4E and I can see the stored procedure and can preview the data. When I try to run the report and override the datasource, it throws oracle error saying "ORA-01008: Not all variables bound". When I tried to use the option
DBOptions._doNotVerifyDB
while replacing connection I get the this error
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean
at java.lang.Boolean.compareTo(Boolean.java:26)
at com.crystaldecisions.sdk.occa.report.lib.ClonableMap.hasContent(ClonableMap.java:112)
at com.crystaldecisions.client.helper.CloneUtil.hasContent(CloneUtil.java:135)
at com.crystaldecisions.sdk.occa.report.data.ConnectionInfo.hasContent(SourceFile:151)
at com.crystaldecisions.client.helper.CloneUtil.hasContent(CloneUtil.java:135)
at com.crystaldecisions.sdk.occa.report.data.Table.hasContent(SourceFile:286)
at com.crystaldecisions.sdk.occa.report.data.Procedure.hasContent(SourceFile:212)
at com.crystaldecisions.sdk.occa.report.lib.ArrayListMerger.haveMatchingContent(ArrayListMerger.java:232)
at com.crystaldecisions.sdk.occa.report.lib.ArrayListMerger.mergePass(ArrayListMerger.java:138)
at com.crystaldecisions.sdk.occa.report.lib.ArrayListMerger.merge(ArrayListMerger.java:86)
at com.crystaldecisions.sdk.occa.report.lib.ControllableList.copyTo(ControllableList.java:68)
at com.crystaldecisions.sdk.occa.report.data.Database.copyTo(SourceFile:105)
at com.crystaldecisions.sdk.occa.report.lib.ControllableHelper.copyToPreservingReferences(ControllableHelper.java:153)
at com.crystaldecisions.sdk.occa.report.application.ReportClientDocument.a(SourceFile:2556)
at com.crystaldecisions.sdk.occa.report.application.b9.onDataSourceChanging(SourceFile:315)
at com.crystaldecisions.sdk.occa.report.application.DatabaseController.a(SourceFile:971)
at com.crystaldecisions.sdk.occa.report.application.DatabaseController.a(SourceFile:4078)
at com.crystaldecisions.sdk.occa.report.application.bv.new(SourceFile:121)
at com.crystaldecisions.sdk.occa.report.application.bv.int(SourceFile:91)
at com.crystaldecisions.proxy.remoteagent.UndoUnitBase.performDo(SourceFile:151)
at com.crystaldecisions.proxy.remoteagent.UndoUnitBase.a(SourceFile:106)
at com.crystaldecisions.sdk.occa.report.application.DatabaseController.a(SourceFile:2159)
at com.crystaldecisions.sdk.occa.report.application.DatabaseController.mapFields(SourceFile:4061)
at com.crystaldecisions.sdk.occa.report.application.DatabaseController.a(SourceFile:3914)
at com.crystaldecisions.sdk.occa.report.application.DatabaseController.replaceConnection(SourceFile:3880)
at
Please advice if Stored procedures and packages are supported in CR4E ?Hi, Jack76,
According to the [CR4E Release Notes|http://help.sap.com/businessobject/product_guides/cr4E/en/cr4e_relnotes_en.pdf] (available from the [CR4E Download page|http://www.businessobjects.com/campaigns/forms/downloads/crystal/eclipse/datasave.asp]), stored procedures are supported, as long as they don't use parameters that need null values.
I don't see any references to packages.
Bryan -
Difference between a "stored procedure" and a "procedure defined in package
Hi,
Is there any difference between a "stored procedure" and a "procedure defined in package"
thanks in advancehttp://download.oracle.com/docs/cd/B19306_01/appdev.102/b14251/adfns_packages.htm#sthref779
Steps
http://www.oracle.com/pls/db102/homepage
http://www.oracle.com/pls/db102/search?word=stored+procedure+package
5th result -
Hello Experts,
Is there any efficient way to see what stored procedures and ssis packages are connecting to server ss-cube?
Can you please help me to come across.
Thanks in advance,
Regards,
HariHello Experts,
Is there any efficient way to see what stored procedures and ssis packages are connecting
to server ss-cube?
Can you please help me to come across.
Thanks in advance,
Regards,
Hari -
Help....on stored procedure (or package)
Hi,
I have any problem to create stored procedure in Oracle, Can you help me?
I have to create a stored procedure (or package) in order to reserve the free rooms to the students in the period comprised between the DATE_START and DATE_END.
Table of the present rooms in building BL1 (RM): SEX 1 = M - SEX 2 = F SEX = 0 (ROOM WITHOUT SEX)
BL_ID.....FL_ID.......RM_ID.........SEX......RM_STD.....RM_CAT
BL1.........1..........101..............1........S........ROOM
BL1.........1..........102..............0........D........ROOM
BL1.........1..........103..............2........T........ROOM
BL1.........2..........201..............2........S........ROOM
BL1.........2..........202..............1........D........ROOM
BL1.........2..........203..............1........T........ROOM
BL1.........3..........301..............2........S........APARTMENT
BL1.........3..........302..............2........D........APARTMENT
BL1.........3..........303..............1........T........APARTMENT
BL1.........3..........304..............1........D........APARTMENT
BL1.........3..........305..............0........D........APARTMENT
Table of the students (EM):
EM_ID...........BL_ID.......FL_ID........RM_ID........COD_STUD
SABRINA..........BL1..........1............102.........524505
TAKEM............BL1..........1............103.........569673
SERAFINO.........BL1..........1............103.........589920
STELLA...........BL1..........1............102.........574659
CHIARA...........BL1..........1............101.........587845
VIDAL............BL1..........1............102.........602877
ROSARIA..........BL1..........2............202.........517070
LUCA.............BL1..........2............201.........602743
DANIELA..........BL1..........2............203.........602865
ANNAMARIA........BL1..........3............305.........588721
LUIGI............BL1..........3............304.........546517
Type of rooms (RM_STD):
RM_STD.......STD_EM........DESCRIPTION
D.............4..............DOUBLE
T.............6..............TRIPLE
S.............2..............SINGLE
Tables of the reservations carried out from the students (RMPCT):
EM_ID......BL_ID........FL_ID......RM_ID......DATE_START.......DATE_END.......COD_STUD
CHIARA......BL1.........1..........101.......11/02/2004.......12/02/2004.......587845
CHIARA......BL1.........1..........101.......03/02/2005.......16/02/2005.......587845
SERAFINO....BL1.........1..........102.......12/02/2004.......19/02/2004.......589920
VIDAL.......BL1.........1..........102.......16/02/2004.......01/03/2004.......602877
SERAFINO....BL1.........1..........103.......01/02/2004.......15/02/2004.......589920
TAKEM.......BL1.........1..........103.......04/02/2005.......10/02/2005.......569673
LUCA........BL1.........2..........201.......03/02/2005.......23/02/2005.......602743
ROSARIA.....BL1.........2..........202.......03/02/2005.......16/02/2005.......517070
DANIELA.....BL1.........2..........203.......03/02/2005.......04/02/2005.......602865
LUIGI.......BL1.........3..........301.......03/02/2005.......23/02/2005.......546517
VALERIA.....BL1.........3..........302.......12/02/2004.......16/02/2004.......515348
CHIARA......BL1.........3..........302.......05/02/2004.......15/02/2004.......587845
CHIARA......BL1.........3..........304.......10/02/2004.......12/02/2004.......587845
CHIARA......BL1.........3..........305.......20/01/2004.......04/02/2004.......587845
ANNAMARIA...BL1.........3..........305.......03/02/2005.......16/02/2005.......588721
INPUT PARAMETERS:
CREATE OR REPLACE Procedure RESERVE_ROOMS (stud_name varchar2,
cod_stud varchar2,
bl_in varchar2,
fl_in varchar2,
rm_in in varchar2,
sex_in varchar2,
date_start_in varchar2,
date_end_in varchar2)
CONDITIONS:
verify if there are students in table EM:
select count (1)
into v_appo
from em
where em_id = stud_name
and cod_stud = cod_stud;
if v_appo = 0 then
insert new student:
insert into em (em_id,cod_sud,sex)
values (stud_name,cod_stud,sex_in);
Now I must verify the free rooms in the period comprised between the DATE_START_IN and DATE_END_IN.
I tried this query: (seem correct...have you any idea?)
select bl_id,fl_id,rm_id,RM_STD
from rm
where (bl_id,fl_id,rm_id,RM_STD) not in (select a.bl_id,a.fl_id,a.rm_id,A.RM_STD
from rm a, rmpct b
where a.bl_id=b.bl_id
and a.fl_id=b.fl_id
and a.rm_id=b.rm_id
AND((b.date_start <= TO_DATE(date_start_in, 'dd-mm-YYYY')
AND b.date_end >= TO_DATE(date_end_in, 'dd-mm-YYYY'))
OR ( b.date_end <= TO_DATE(date_end_in, 'dd-mm-YYYY'))
AND b.date_end >= TO_DATE(date_start_in, 'dd-mm-YYYY')
OR ( b.date_start >= TO_DATE(date_start_in, 'dd-mm-YYYY')
and b.date_start <= TO_DATE(date_end_in, 'dd-mm-YYYY')
AND b.date_end >= TO_DATE(date_end_in, 'dd-mm-YYYY'))))
with this query I get all free rooms in period date_start_in - date_end_in, but I must,also,verify if there are double or triple rooms (reserved) with minus of 2 (double) or minus of 3 (triple) students. If there are I can reserved these rooms.
I tried to verify with these steps:
CREATE OR REPLACE VIEW COUNT_EM ( BL_ID,
FL_ID, RM_ID, NUMBER_EM ) AS
(SELECT rm.bl_id, rm.fl_id, rm.rm_id, COUNT(*) as numero_em
FROM em, rm
WHERE em.bl_id(+) = rm.bl_id
AND em.fl_id(+) = rm.fl_id
AND em.rm_id(+) = rm.rm_id
and rm.rm_std in ('S', 'D', 'T')
group by rm.bl_id, rm.fl_id, rm.rm_id)
CREATE OR REPLACE VIEW COUNT_RMPCT ( BL_ID,
FL_ID, RM_ID, STD_EM, NUMBER_RMPCT
) AS
SELECT rm.bl_id, rm.fl_id, rm.rm_id, rmstd.std_em, COUNT(*) as numero_rmpct
FROM rm, rmpct,rmstd
WHERE rmpct.bl_id(+) = rm.bl_id
AND rmpct.fl_id(+) = rm.fl_id
AND rmpct.rm_id(+) = rm.rm_id
and rm.rm_std=rmstd.rm_std
and rm.rm_std in ('S', 'D', 'T')
AND((rmpct.date_start <= TO_DATE(date_start_in', 'dd-mm-YYYY')
AND rmpct.date_end >= TO_DATE(date_end_in, 'dd-mm-YYYY'))
OR ( rmpct.date_end <= TO_DATE(date_end_in, 'dd-mm-YYYY'))
AND rmpct.date_end >= TO_DATE(date_start_in, 'dd-mm-YYYY')
OR ( rmpct.date_start >= TO_DATE(date_start_in, 'dd-mm-YYYY')
and rmpct.date_start <= TO_DATE(date_end_in, 'dd-mm-YYYY')
AND rmpct.date_end >= TO_DATE(date_end_in, 'dd-mm-YYYY')))
group by rm.bl_id, rm.fl_id, rm.rm_id, rmstd.std_em
AND FINALLY:
select a.bl_id, a.fl_id, a.rm_id, a.NUMBER_RMPCT, B.NUMBER_EM, a.std_em, (a.std_em - (a.NUMBER_RMPCT+B.NUMBER_EM)) RM_FREE
from COUNT_RMPCT a, COUNT_EM b
where a.bl_id=b.bl_id
and a.fl_id=b.fl_id
and a.rm_id=b.rm_id
if RM_FREE > 0 THEN there are free rooms (D or T) between those occupied in that period.
Now If the room (bl_in,fl_in,rm_in) is free I can reserve inserting it in the table RMPCT:
INSERT INTO rmpct (bl_id, fl_id, rm_id,em_id,cod_stud,date_start, date_end)
values(bl_in,fl_in,rm_in,stud_name,cod_stud,date_start_in,date_end_in);
If I haven't rm_in (can be null) I must reserve the first free room (random).
after these controls: I update table of the students:
UPDATE em
Set bl_id = BL_IN,fl_id= FL_IN,rm_id=rm_in
where em_id=stud_name
and cod_stud=cod_stud;
Finally I must make a control on the sex of the room, because there are rooms that have sex=0
if RM.SEX <> 0 then
null
else
if rm_cat = 'ROOM' then
UPDATE rm
set sex = sex_in
where bl_id = in
and fl_id = in
and rm_id = in;
if rm_cat = 'APARTMENT' then (update on all rooms)
UPDATE rm
set sex = sex_in
where bl_id = in
and fl_id = in;
IF v_appo > 0 then
Same controls except: insert into em (em_id,cod_sud,sex)
values (stud_name,cod_stud,sex_in);
How I can insert in one stored procedure (or package) all these instructions and controls?
Thanks in advance!In the following demonstation, I have changed the names of some of your variables, in order to standardize them. I have prefaced input parameters with p_ and local variables with v_ and followed them with the name of the column that they are associated with when appropriate. This avoids conflicts with any column names and makes the code easier to read and follow. I have also used table_name.column_name%type to specify the data type associated with the variables instead of using varchar2. That way, if the data type of the columns changes, the code does not have to be updated. This is standard practice.
In your first insert statement, you have attempted to insert sex into the em table, but there is no sex column in the em table data that you displayed, so I removed the sex.
Instead of using a complicated mess of views and such to check whether there is a room available and then assign it, I have used just one select statement to select an available room and used an exception clause that handles a no_data_found exception to deal with when there is no room available.
I have greatly simplified your checking of dates within that select statement.
You were on the right track with the outer joins and grouping and checking for single, double, or triple rooms. Instead of count, I have used sum and nvl2, so that only the occupied rooms are counted and the rows generated by the outer join are zeroes.
I have used the nvl function to allow for null values in the input parameters, so that any room can be selected. I used dbms_random.random to ensure that the rows are ordered randomly, but you can leave that out if it is really not that critical that the result be truly random and any row will do. I have used rownum=1 in an outer query to select just one row.
When you select from a table in pl/sql, you have to select into something. You cannot just issue a select statement, then use an if statement to compare some value in the select statement. For example, you cannot use "if rm.sex ..." you have to select rm.sex into a variable, like v_sex, then use "if v_sex ...". So, I have selected the result of the select statement into local variables, then used those variables for comparisons. I have also used those variables for inserting and updating the appropriate tables, rather than just using the original input parameters, since some of them may have been null.
In the example below, I have demonstrated how the procedure rejects an unavailable room, accepts a specific available room, and randomly assigns a room.
-- procedure:
scott@ORA92> CREATE OR REPLACE PROCEDURE reserve_rooms
2 -- input parameters:
3 (p_em_id IN em.em_id%TYPE,
4 p_cod_stud IN em.cod_stud%TYPE,
5 p_bl_id IN rm.bl_id%TYPE,
6 p_fl_id IN rm.fl_id%TYPE,
7 p_rm_id IN rm.rm_id%TYPE,
8 p_sex IN rm.sex%TYPE,
9 p_date_start IN VARCHAR2,
10 p_date_end IN VARCHAR2)
11 AS
12 -- local variables:
13 v_appo INTEGER;
14 v_bl_id rm.bl_id%TYPE;
15 v_fl_id rm.fl_id%TYPE;
16 v_rm_id rm.rm_id%TYPE;
17 v_rm_cat rm.rm_cat%TYPE;
18 v_sex rm.sex%TYPE;
19 BEGIN
20 -- verify if the student is in table em:
21 SELECT COUNT (*)
22 INTO v_appo
23 FROM em
24 WHERE em_id = p_em_id
25 AND cod_stud = p_cod_stud;
26 -- if the student is not in table em, then insert new student:
27 IF v_appo = 0 THEN
28 INSERT INTO em (em_id, cod_stud)
29 VALUES (p_em_id, p_cod_stud);
30 END IF;
31 BEGIN
32 -- find available room:
33 SELECT bl_id, fl_id, rm_id, sex, rm_cat
34 INTO v_bl_id, v_fl_id, v_rm_id, v_sex, v_rm_cat
35 FROM (SELECT rm.bl_id, rm.fl_id, rm.rm_id, rm.sex, rm.rm_cat
36 FROM rmpct, rm
37 WHERE rm.bl_id = rmpct.bl_id (+)
38 AND rm.fl_id = rmpct.fl_id (+)
39 AND rm.rm_id = rmpct.rm_id (+)
40 AND rm.bl_id = NVL (p_bl_id, rm.bl_id)
41 AND rm.fl_id = NVL (p_fl_id, rm.fl_id)
42 AND rm.rm_id = NVL (p_rm_id, rm.rm_id)
43 AND (rm.sex = p_sex OR rm.sex = 0)
44 AND rmpct.date_start (+) <= TO_DATE (p_date_end, 'DD-MM-YYYY')
45 AND rmpct.date_end (+) >= TO_DATE (p_date_start, 'DD-MM-YYYY')
46 GROUP BY rm.bl_id, rm.fl_id, rm.rm_id, rm.sex, rm.rm_cat, rm.rm_std
47 HAVING SUM (NVL2 (rmpct.rm_id (+), 1, 0))
48 < DECODE (rm_std, 'S', 1, 'D', 2, 'T', 3)
49 ORDER BY DBMS_RANDOM.RANDOM)
50 WHERE ROWNUM = 1;
51 -- reserve room:
52 INSERT INTO rmpct (bl_id, fl_id, rm_id, em_id, cod_stud, date_start, date_end)
53 VALUES (v_bl_id, v_fl_id, v_rm_id, p_em_id, p_cod_stud,
54 TO_DATE (p_date_start, 'DD-MM-YYYY'),
55 TO_DATE (p_date_end, 'DD-MM-YYYY'));
56 -- update students:
57 UPDATE em
58 SET bl_id = v_bl_id, fl_id = v_fl_id, rm_id = v_rm_id
59 WHERE em_id = p_em_id
60 AND cod_stud = p_cod_stud;
61 -- update sex of room or apartment floor:
62 IF v_sex = 0 THEN
63 IF v_rm_cat = 'ROOM' THEN
64 UPDATE rm
65 SET sex = p_sex
66 WHERE bl_id = v_bl_id
67 AND fl_id = v_fl_id
68 AND rm_id = v_rm_id;
69 ELSIF v_rm_cat = 'APARTMENT' THEN
70 UPDATE rm
71 SET sex = p_sex
72 WHERE bl_id = v_bl_id
73 AND fl_id = v_fl_id;
74 END IF;
75 END IF;
76 EXCEPTION
77 -- if no room is available:
78 WHEN NO_DATA_FOUND THEN
79 RAISE_APPLICATION_ERROR (-20001, 'Sorry, there is no such room available.');
80 END;
81 END reserve_rooms;
82 /
Procedure created.
scott@ORA92> SHOW ERRORS
No errors.
-- rejects unavailable room of wrong sex:
scott@ORA92> EXECUTE reserve_rooms ('BARBARA', 654321, 'BL1', 1, 101, 2, '04-02-2005', '10-02-2005')
BEGIN reserve_rooms ('BARBARA', 654321, 'BL1', 1, 101, 2, '04-02-2005', '10-02-2005'); END;
ERROR at line 1:
ORA-20001: Sorry, there is no such room available.
ORA-06512: at "SCOTT.RESERVE_ROOMS", line 79
ORA-06512: at line 1
-- accepts available room of same sex:
scott@ORA92> EXECUTE reserve_rooms ('BARBARA', 654321, 'BL1', 1, 103, 2, '04-02-2005', '10-02-2005')
PL/SQL procedure successfully completed.
-- assigns random available room of same or no sex:
scott@ORA92> EXECUTE reserve_rooms ('BARBARA', 654321, NULL, NULL, NULL, 2, '11-02-2005', '23-02-2005')
PL/SQL procedure successfully completed.
-- results:
scott@ORA92> -- one and only one row added to em table:
scott@ORA92> SELECT * FROM em WHERE em_id = 'BARBARA'
2 /
EM_ID BL_I FL_ID RM_ID COD_STUD
BARBARA BL1 1 102 654321
scott@ORA92> -- rooms reserved and other people who have reserved same room
scott@ORA92> -- (there are 3 who reserved a double room, but only 2 at a time):
scott@ORA92> SELECT *
2 FROM rmpct
3 WHERE (bl_id, fl_id, rm_id) IN
4 (SELECT bl_id, fl_id, rm_id
5 FROM rmpct
6 where em_id = 'BARBARA')
7 /
EM_ID BL_ FL_ID RM_ID DATE_STAR DATE_END COD_STUD
BARBARA BL1 1 102 11-FEB-05 23-FEB-05 654321
SERAFINO BL1 1 102 12-FEB-04 19-FEB-04 589920
VIDAL BL1 1 102 16-FEB-04 01-MAR-04 602877
SERAFINO BL1 1 103 01-FEB-04 15-FEB-04 589920
TAKEM BL1 1 103 04-FEB-05 10-FEB-05 569673
BARBARA BL1 1 103 04-FEB-05 10-FEB-05 654321
6 rows selected.
scott@ORA92> -- rooms reserved are all correct sex
scott@ORA92> -- (note that room 102 was updated from 0 to 2):
scott@ORA92> SELECT *
2 FROM rm
3 WHERE (bl_id, fl_id, rm_id) IN
4 (SELECT bl_id, fl_id, rm_id
5 FROM rmpct
6 where em_id = 'BARBARA')
7 /
BL_ FL_ID RM_ID SEX R RM_CAT
BL1 1 102 2 D ROOM
BL1 1 103 2 T ROOM
scott@ORA92> -
Calling of stored procedure in package
Hi,
I have one stored procedure A. And one package of name P1.
I have execute previlage of package but not having any previlge of stored procedure.
and In package P1 stored procedure A is called. then this packege is work or it will genrate an Error?Oracle users - userA, userB
Stored procedure - procedure1
Package - package1
Who is owner of procedure1 and package1?
Which privileges of userA/userB on procedure1 and package1? -
Triggers, Stored Procedures and Java
Hi all.
I started developing some useful (at least for me) Java Package, and I'm wondering if I'm doing the right thing.
Let's say that I have a trigger that calls a Stored Procedure that calls a Java Package.
Let's say that the Java Package can be used by more than one Oracle Schema.
So, my question is:
Should I load the package in every Schema ? Or should I load the package in the System (for instance) schema, creating synonyms for it (if possible) ? Or should I create both the package and the Stored Procedure in System, creating synonyms for the procedure ?
I'm a little stuck in this....
Another question : when my trigger fires, it launch the Stored Procedure and, consequently, my Java Package.... At this point, am I in the same transaction of the trigger ? Or the Java Package start a new "subtransaction" ?
Thanks in advance for Your help.
Best Regards
Fabio GRANDEDo not create anything in the System schema. Create the package and procedure in one schema and create a public synonym that the other schemas can use to access it.
And yes the trigger and anything it executes are all part of the same transaction. As long as none of the procedures are declared as an autonomous transaction, in which case that procedure would be a separate transaction. -
How to copy procedures and packages from one server to another?
Hi,
I have 439 packages and 178 procedures located in one server called MAXWELL.
I need to copy these objects to another server called TITAN.
The schema names is SPCBR in both servers.
So both servers have an instance running with this schema SPCBR.
SPCBR in TITAN server has their tables with table data which was generated by an export/import process from MAXWELL server.
However, procedures and packages were not copied by the export/import because I used the clause 'tables'.
Now, what can I do in order to equalize procedures and packages in both databases? I can't risk in damaging or duplicating data in my database located in TITAN server, ok?
Thanks,Another simple alternative, according to AskTom (http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:454220160386)
---------------- getcode.sql ----------------------------
set feedback off
set heading off
set termout off
set linesize 1000
set trimspool on
set verify off
spool &1..sql
prompt set define off
select decode( type||'-'||to_char(line,'fm99999'),
'PACKAGE BODY-1', '/'||chr(10),
null) ||
decode(line,1,'create or replace ', '' ) ||
text text
from user_source
where name = upper('&&1')
order by type, line;
prompt /
prompt set define on
spool off
set feedback on
set heading on
set termout on
set linesize 100
------------------- eof --------------------------------
it extracts one procedure, function or package to a file. Thats it. If you
wanted to get all of the procedures in a schema extracted to the current working
directory, you would run a script:
--------------- getallcode ---------------------------
set termout off
set heading off
set feedback off
set linesize 50
spool xtmpx.sql
select '@getcode ' || object_name
from user_objects
where object_type in ( 'PROCEDURE', 'FUNCTION', 'PACKAGE' )
spool off
spool getallcode_INSTALL.sql
select '@' || object_name
from user_objects
where object_type in ( 'PROCEDURE', 'FUNCTION', 'PACKAGE' )
spool off
set heading on
set feedback on
set linesize 130
set termout on
@xtmpx.sql
---------------- eof ---------------------------------
You can see how to filter on that one by adding to the where clause if you want.
Just run @getallcode_INSTALL to run all of the scripts... -
How to create a stored procedure and use it in Crystal reports
Hi All,
Can anyone explain me how to create a stored procedure and use that stored procedure in Crystal reports. As I have few doubts in this process, It would be great if you can explain me with a small stored proc example.
Thanks in advance.If you are using MSSQL SERVER then try creating a stored procedure like this
create proc Name
select * from Table
by executing this in sql query analyzer will create a stored procedure that returns all the data from Table
here is the syntax to create SP
Syntax
CREATE PROC [ EDURE ] procedure_name [ ; number ]
[ { @parameter data_type }
[ VARYING ] [ = default ] [ OUTPUT ]
] [ ,...n ]
[ WITH
{ RECOMPILE | ENCRYPTION | RECOMPILE , ENCRYPTION } ]
[ FOR REPLICATION ]
AS sql_statement [ ...n ]
Now Create new report and create new connection to your database and select stored procedure and add it to the report that shows all the columns and you can place the required fields in the report and refresh the report.
Regards,
Raghavendra
Edited by: Raghavendra Gadhamsetty on Jun 11, 2009 1:45 AM -
How to create stored procedures and use those in Crystal reports
Hi All,
Can anyone explain me how to create a stored procedure and use that stored procedure in Crystal reports. As I have few doubts in this process, It would be great if you can explain me with a small stored proc example.
Thanks in advance.Hello,
There is a document explainining how to use Oracle stored proc with Crystal reports.
Check at:
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/1084c536-711e-2b10-e48a-924a60745253
It is for older version but it should work and you can refer to it to get general idea how to start with it. It has a sample oracle stored proc and how to connect it from Crystal Reports. -
How to handle Stored Procedure and Views
Dear All
While dealing with Oracle database related scenario. I came across Stored Procedures and Views. Which are complex in nature. Using SAP XI how we can handle them ?
Is JDBC adaptor is capable of that.? Can you help me Data type structure for oracle.
How max occur play important role in that. How to identify root and item level structure for oracle
I am dealing with stored procedures while inserting data. and using views i need to get data from oracle database.
What is the syntax of query we use to put while using JDBC adaptor?
Please help and provide bit detail information over this so that i can execute scenario
Thanks
Gaurav1) jdbc:oracle:thin:@xxx.xxx.xxx.xxx:1521:sid
2)Occurence==> o,1, >1 , Unbounded
Occurrence=> ready to accept 0 / 1 / more than 1/ multiple record (for source) and how it will be passed to target.
http://help.sap.com/saphelp_erp2004/helpdata/en/b6/0b733cb7d61952e10000000a11405a/frameset.htm
3)
<StatementName5>
<storedProcedureName action= EXECUTE>
<table>realStoredProcedureeName</table>
<param1 [isInput=true] [isOutput=true] type=SQLDatatype>val1</param1>
</storedProcedureName >
</StatementName5>
refer
http://help.sap.com/saphelp_nw04/helpdata/en/22/b4d13b633f7748b4d34f3191529946/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/frameset.htm -
Dynamically calling stored procedure and getting result set c++
Hello,
I am trying to write some c++ code that will dynamically bind values to a stored procedure and excute the procedure and get back a resultset. The problem I am running into is how to get back the resultset. Any help or example would be highly appreciated.int main(int argc, char* argv[])
OCIError* pOciError;
char* pConnectChar = "dbname";
char* pUsernameChar = "scott";
char* pPasswordChar = "tiger";
int answer;
OCIStmt* pOciStatement;
char* sqlCharArray = "BEGIN :success := sp_ListEmp; END;";
int id;
char ename[40];
OCIEnv* g_pOciEnvironment = NULL;
OCIServer* g_pOciServer = NULL;
OCISession* g_pOciSession = NULL;
OCISvcCtx* g_pOciServiceContext = NULL;
sb2* pIndicator=0;
sb2* pIndicator2=0;
sb2* pIndicator3=0;
OCIDefine* pOciDefine;
OCIDefine* pOciDefine2;
OCIBind* pBind;
OCIStmt* cursor;
answer = OCIInitialize(OCI_THREADED, NULL, NULL, NULL, NULL);
answer = OCIEnvInit(&g_pOciEnvironment, OCI_DEFAULT, 0, NULL);
answer = OCIHandleAlloc(g_pOciEnvironment, (void **)&pOciError, OCI_HTYPE_ERROR, 0, NULL);
answer = OCIHandleAlloc(g_pOciEnvironment, (void **)&g_pOciSession, OCI_HTYPE_SESSION, 0, NULL);
answer = OCIHandleAlloc(g_pOciEnvironment, (void **)&g_pOciServer, OCI_HTYPE_SERVER, 0, NULL);
answer = OCIHandleAlloc(g_pOciEnvironment, (void **)&g_pOciServiceContext, OCI_HTYPE_SVCCTX, 0, NULL);
answer = OCIServerAttach(g_pOciServer, pOciError, (unsigned char *)pConnectChar, strlen(pConnectChar),
OCI_DEFAULT);
answer = OCIAttrSet(g_pOciSession, OCI_HTYPE_SESSION, (unsigned char *)pUsernameChar, strlen(pUsernameChar),
OCI_ATTR_USERNAME, pOciError);
answer = OCIAttrSet(g_pOciSession, OCI_HTYPE_SESSION, (unsigned char *)pPasswordChar, strlen(pPasswordChar),
OCI_ATTR_PASSWORD, pOciError);
answer = OCIAttrSet(g_pOciServiceContext, OCI_HTYPE_SVCCTX, g_pOciServer, 0, OCI_ATTR_SERVER, pOciError);
answer = OCIAttrSet(g_pOciServiceContext, OCI_HTYPE_SVCCTX, g_pOciSession, 0, OCI_ATTR_SESSION, pOciError);
answer = OCISessionBegin(g_pOciServiceContext, pOciError, g_pOciSession, OCI_CRED_RDBMS, OCI_DEFAULT);
answer = OCIHandleAlloc(g_pOciEnvironment, (void **)(&pOciStatement), OCI_HTYPE_STMT, 0, NULL);
answer = OCIStmtPrepare(pOciStatement, pOciError, (unsigned char *)sqlCharArray, strlen(sqlCharArray),
OCI_NTV_SYNTAX, OCI_DEFAULT);
answer = OCIHandleAlloc(g_pOciEnvironment, (void **)(&cursor), OCI_HTYPE_STMT, 0, NULL);
answer = OCIBindByPos(pOciStatement,&pBind, pOciError, 1, &cursor, 0,SQLT_RSET,
pIndicator2, 0,NULL, 0,0,OCI_DEFAULT);
answer = OCIStmtExecute(g_pOciServiceContext, pOciStatement, pOciError, 1, 0, NULL, NULL,
OCI_COMMIT_ON_SUCCESS);
answer = OCIDefineByPos(cursor,&pOciDefine, pOciError,2,&id,sizeof(int),
SQLT_INT,pIndicator, 0, 0,OCI_DEFAULT);
answer = OCIDefineByPos(cursor,&pOciDefine2, pOciError,1,ename,40,
SQLT_STR,pIndicator3, 0, 0,OCI_DEFAULT);
if (answer == 0)
while ((answer = OCIStmtFetch(cursor,pOciError, 1,OCI_FETCH_NEXT,OCI_DEFAULT)) == 0)
printf("fetched id %d and name %s\n",id,ename);
answer = OCIHandleFree(pOciError, OCI_HTYPE_ERROR);
return 0; -
Stored procedure and peoplecode in app engine
Hey all,
i want to call a stored procedure in peoplecode using sqlexec. i guess the following syntax is correct.
sqlexec("exec sp_name");
my question is
will the peoplecode wait until the stored procedure completes?
or
will it just send the command to database to execute the stored procedure and continue executing the next statements after the sql exec.
Please let me know if i am not explain better and need to give an example.
Please help me.
thank you."...will the peoplecode wait until the stored procedure completes"
Yes.
Nicolas. -
How can I compile all functions, procedures and packages with a script?
I need to compile all functions, procedures and packages of 5 schemas (users) with a script.
How can I do it?
Thanks!you can create a script to select all invalid objects in those schemas Since Oracle 8 introduced NDS this approach has struck me as a trifle old fashioned. It's much simpler to loop round the query in PL/SQL and use EXECUTE IMMEDIATE to fire off the DDL statements. No scripts, no muss, no fuss.
Having said that, the problem with this approach and also with using DBMS_UTILITY.COMPILE_SCHEMA is that they do not compile all the invalid objects in dependency order. This may result in programs being invalidated by the subsequent compilation of dependencies. This is due to the introduction of Java into the database.
The UTLRP script is much better, because it (usually) avoids cyclic references. But you still may need to run it more than once.
In general it is better to avoid sledgehammer recompilations (like DBMS_UTILITY.COMPILE_SCHEMA, which starts by invalidating all the objects). If we have twenty invalid objects, nineteen of which are dependencies of the twentieth, we actually only need to recompile the master object, as recompiling it will trigger the recompilation of all the others.
Cheers, APC -
Java stored procedures and triggers in lite
Hi
We are using java stored procedures and java triggers in our application for oracle lite database 5.1.
We would like to know whether these procedures and triggers are uploaded or associated with tables or not because triggers are not being fired for the tables.
The question is - how to find the uploaded procedures and triggers in system tables.
We dont find any tables like (all_objects, user_objects) for this in oracle lite system catalogs given in the documentation.
thanks in advance
yugandharI don't have much experience with Lite, but I'm running 9i Personal Edition. Any information about triggers can be found in the "ALL_TRIGGERS" view. You will want to filter out any rows where OWNER = 'SYS' unless you created your triggers as SYS. As for procedures and functions, you can see what you have created in the "ALL_OBJECTS" view where OBJECT_TYPE = 'PROCEDURE' or 'FUNCTION', once again filtering out rows where OWNER = 'SYS'. To see the code of any procedure or function, select substr(text,1,80) from ALL_SOURCE where NAME = 'function name' ORDER BY LINE.
Hope this helps!
Maybe you are looking for
-
Is it possible to inspect on my Android device once I use the "Open In Browser" feature? I need to debug in other browsers besides the default browser. Thanks, Daniel
-
I've lost CS5 Design Premium Teachers Edition CD Installation Package. How can I download it? Typical version of CS 5 Design Premium is not working with my serial number. Can someone help me?
-
What happened to my service in Mexico?
I suddenly do not have service in Mexico. My plan says that I do and I am in an area that I have spent much time in the last 4 years having few problems. Suddenly my service is gone. In a time of emergency it wasn't there leaving me in a dangerous si
-
SLDCHECK fails in XI - SLD running on Solman server
Dear All, I have SLD configured on my solution manager system. All systems including XI are updating data in SLD -> Technical Systems. My problem When I execute SXMB_IFR, SLD web page opens up fine. But in transaction log I see following: Calling fun
-
Any way to load/buffer a video file without playing it?
I want to play an f4v file in flash, however when I play it I want it to already be loaded and buffered before I send the commands to play it. is there an example anyone an hand me of doing this? my purpose is to have some events going on in the SWF