XSQL and Packaged Procedure
I've been reading thru the postings for XSQL and read a couple of references on how to get an out variable from a stored procedure. I read this thread from 3/31:
http://technet.oracle.com:89/ubb/Forum11/HTML/001444.html
Anyway, I followed the advice and I get the following error message:
ORA-06571: Function CHECK_USER does not guarantee not to update database
Did some research and found that I would need to create a PRAGMA in my function, which would need to be packaged. I did that, but the function would not compile because it would not fulfil the pragma. Below is the procedure I am trying to run, the wrapper function, and the XSQL source. Any ideas?
Thanks
Procedure
Procedure check_user( inSiteID varchar2,
v_userid number default null,
inExtID varchar2 default null,
v_return out varchar2)
AS
ParamIsNull EXCEPTION;
invalid_data EXCEPTION;
v_errmsg varchar2(200);
v_count number := 0;
BEGIN
If v_userid Is Null AND inExtID Is Null Then Raise ParamIsNull; End If;
If v_userid Is Not Null AND inExtID Is Not Null Then Raise ParamIsNull; End If;
If v_userid Is Not Null Then
SELECT COUNT(1) INTO v_count FROM USERS WHERE site_id=inSiteID and USERID = v_userid;
If v_count = 0 then
v_errmsg := '0, UserID Not Found';
raise invalid_data;
Else
v_return:=('1');
End if;
End If;
If inExtID Is Not Null Then
SELECT COUNT(1) INTO v_count FROM USERS WHERE site_id=inSiteID and ext_uid = inExtID;
If v_count = 0 then
v_errmsg := '0, External ID Not Found';
raise invalid_data;
Else
v_return:=('1');
End if;
End If;
EXCEPTION
WHEN ParamIsNull THEN
v_return:=('0,1 Parameter Expected');
WHEN invalid_data THEN
v_return:=v_errmsg;
END check_user;
Function
CREATE OR REPLACE PACKAGE DON AS
FUNCTION CHECK_USER (siteid IN VARCHAR2, userid IN NUMBER, extid IN VARCHAR2)
RETURN VARCHAR2;
PRAGMA RESTRICT_REFERENCES (CHECK_USER, WNDS);
END DON;
CREATE OR REPLACE PACKAGE BODY DON AS
FUNCTION CHECK_USER (siteid IN VARCHAR2, userid IN NUMBER, extid IN VARCHAR2)
RETURN VARCHAR2 IS v_return VARCHAR2(200);
BEGIN
OTS_SCOPUS_PACK.CHECK_USER(siteid, userid, extid, v_return);
RETURN v_return;
END;
END DON;
XSQL Source
<?xml version="1.0"?>
<xsql:query xmlns:xsql="urn:oracle-xsql" connection="mvdv">
select don.check_user('{@siteid}', {@userid}, '{@extid}') from dual
</xsql:query>
Your 'DON.CHECK_USER' function has a RESTRICT_REFERENCES pragma but it calls 'OTS_SCOPUS_PACK.CHECK_USER' which must also have a RESTRICT_REFERENCES pragma.
All functions/procedures that are called directly or indirectly by 'DON.CHECK_USER' need to have a RESTRICT_REFERENCES pragma to guarantee that they do not write to the database or to a package.
You cannot just write a wrapper function and apply the pragma to it.
Good luck!
null
Similar Messages
-
Xsql and Stored Procedures/Packages
I need to call a stored proc that includes a select statement through XSQL. The procedure returns a ResultSet. I have not been able to find a way to bind this parameter, or to return this ResultSet. Has anybody tried to do this?
TIAThe <xsql:ref-cursor-function> exists for just this purpose.
If you already have a function that returns a REF CURSOR in an OUT parameter of a procedure, just write a wrapper function that returns that OUT value as the return value of a function and then use <xsql:ref-cursor-function> to repurpose it's results as XML in your XSQL page. -
Hi all,
Pl clarify my doubt.
Out of Standalone Procedures and Packaged procedures which is best one?
why?
Thank you,
rampaThis may be helpful to you ...
http://asktom.oracle.com/pls/ask/f?p=4950:8:761888005577920510::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:7452431376537 -
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 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 -
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 -
Searching strings in procedures, function and packages (OWB)
Hi all,
I'm working on an OMB script to look for a string in procedures, function and packages in OWB. So far, I found how to do it for functions and procedures:
string match -nocase \*text_to_find* [OMBRETRIEVE FUNCTION 'my_function' GET PROPERTIES(IMPLEMENTATION)]
string match -nocase \*text_to_find* [OMBRETRIEVE PROCEDURE 'my_procedure' GET PROPERTIES(IMPLEMENTATION)]
I have tried something similar for packages but it didn't work. Does someone know how to do this search in packages? Any help will be appreciated.
Regards,
MauricioOf course, if you are looking for a match in any source - including procedures and packages not imported into OWB, then OMB+ isn't going to be a ton of help as it won't be aware of those other packages.
In that case, you can always find those dependencies by doing a standard select owner, name, type, text from all_source where text like '%YOUR_SEARCH_CRITERIA%' query.
and you can embed that in your OMB+ using the Java/SQL library: How to run SQL from OMB+
Cheers,
Mike -
To generate Script of procedures/functions and packages with grants
Hi
is there wome way for to generate Source Code Script of the some functions, procedures and Packages in file
I must to generate Script withall grants
TiaDatapump export with Content=Metadata_only.
Use SQLFILE option to generate the Schema DDL which
includes
tables,indexes,grants,stats,procedures,triggers,views
etc...Sorry, I'm using 10g , but I don't know to use DataPump, is there other method ?
Thanks -
Exp/imp procedures, functions and packages question
Hi
I've a 9i R2 version Oracle database. I would like to export procedures, functions and packages from a schema. How do I do that?
Is there any script or command lines can provide?
ThanksHello user12259190.
You can do an export of the user itself, excluding table data as inH:\>exp
Export: Release 10.2.0.1.0 - Production on Tue Dec 22 11:22:52 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Username: db_user@db_sid
Password:
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, Data Mining and Real Application Testing options
Enter array fetch buffer size: 4096 >
Export file: EXPDAT.DMP >
(2)U(sers), or (3)T(ables): (2)U > 2
Export grants (yes/no): yes > no
Export table data (yes/no): yes > no
Compress extents (yes/no): yes > no
Export done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set
server uses UTF8 character set (possible charset conversion)
Note: table data (rows) will not be exported
Note: grants on tables/views/sequences/roles will not be exported
. exporting pre-schema procedural objects and actions
. exporting foreign function library names for user DB_USER
. exporting PUBLIC type synonyms
. exporting private type synonyms
. exporting object type definitions for user DB_USER
About to export DB_USER's objects ...
. exporting database links
. exporting sequence numbers
. exporting cluster definitions
. about to export DB_USER's tables via Conventional Path ...
. . exporting table TABLE_NAMEs
EXP-00091: Exporting questionable statistics.
. exporting synonyms
. exporting views
. exporting stored procedures
. exporting operators
. exporting referential integrity constraints
. exporting triggers
. exporting indextypes
. exporting bitmap, functional and extensible indexes
. exporting posttables actions
. exporting materialized views
. exporting snapshot logs
. exporting job queues
. exporting refresh groups and children
. exporting dimensions
. exporting post-schema procedural objects and actions
. exporting statistics
Export terminated successfully with warnings.Unfortunately, you can't export just the objects you want to unless they are tables.
Using import (imp) you can list the content of your packages, procedures, functions, views, etc. and perhaps that will give you what you need.
Another choice would be to useSELECT * FROM user_source ORDER BY 2, 1, 3;to list the code.
Hope this helps,
Luke -
How to Export only some tables with procedures and packages
Hi...
I want to export only some tables and packages and procedures. Can anybody please guide me how to do this.
Thanks in advance.......
palcould you please more elobarate in your question? do you want to export data from tables or you want to get the table structure, source of procedures and packages?
Thanks
M Thiyagarajan -
How to query DDL locks on stored procedures/functions and packages?
Hi!
The subject says it all: How do I see existing DDL locks on stored procedures/functions and packages?
While a procedure is executed it can't be deleted or replaced, so there has to be a DDL lock on it. The information does not seem to be in V$LOCK or V$LOCKED_OBJECTS.
Thanks!
Marcus
Edited by: MMarcus on Nov 21, 2009 3:43 PMHello,
Here you can find an article about the view DBA_DDL_LOCKS:
[http://www.praetoriate.com/int_40.htm]
If you don't have this view on the Data Dictionary, you may have
to execute the "OH/rdbms/admin/catblock.sql" script first.
Hope it can help.
Best regards,
Jean-Valentin -
"Run Script" (F5) Flacky Behavior with CREATE PROCEDURE and PACKAGE
When I have the following create statement in a SQL Worksheet and run the script using "Run Script" (F5), I get the "PROCEDURE bogus Compiled." message. Why does it not tell me that there was a compile error? The procedure is marked with a little red "X" in the connections pane.
CREATE OR REPLACE PROCEDURE bogus IS
BEGIN
x := 1;
END;
/Also, when I have the following command in a SQL Worksheet and run the script using "Run Script" (F5), I get the "PROCEDURE bogus Compiled." message. The difference is that I removed the slash after the CREATE PROCEDURE command. I can go into that procedure in the database via the Connections pane, click on the compile button, and the procedure compiles with no errors. Why does it not compile in a script when missing the slash?
CREATE OR REPLACE PROCEDURE bogus IS
BEGIN
NULL;
END;I noticed the same flaky behavior with CREATE PACKAGE BODY as well. This is in version 1.0.0.14.67 on Windows XP. Has this been fixed in the latest version?
MikeI found a number of earlier posts on this (going back to at least v804), but I cannot find a thread with a response from the SQL Developer team - see:
Package compilation error
Succesful compilation message and Compiling Invalid Objects
Creating a stored procedure from a file does not show compilation errors
Re: Syntax Error Feedback
I assume that it is just a bug with SQL Developer that it does not check for compilation errors when determining the status message to display (ie "PROCEDURE bogus Compiled"). At least now we get the little red cross on the navigator to tell us it is invalid :) -
How to import only procedures, functions, and packages only
Hi everybody...
How to import only procedures, functions, and packages only from one user to another user.
Thanks in advance
palThanks for your reply...i did the following..can you please help from this how to proceed
---------------- 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
------------------- getallcode.sql -------------------------
set termout off
set heading off
set feedback off
set linesize 50
spool c:\xtmpx.sql
select '@getcode ' || object_name
from user_objects
where object_type in ( 'PROCEDURE', 'FUNCTION', 'PACKAGE' )
spool off
spool c:\getallcode_INSTALL
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
I did this one user and created the xtmpx.sql
and getallcode_INSTALL.LST.
From this, how to proceed to run these in another user.
Thanks,
Pal -
Copy procedures, functions and packages to files
Can anyone help me, how to put all procedures, functions and packages to files. It is important, that when procedure have name PROCEDURE_CREATE then file have PROCEDURE_CREATE.txt
Is that possible?Hi,
I guess you want following.
Do:
1 DECLARE
2 CURSOR Cur_All IS SELECT DISTINCT NAME
3 FROM ALL_SOURCE
4 WHERE ROWNUM <= 10 ;
5 -- WHERE OWNER LIKE 'KIN%' ;
6 v_Name ALL_SOURCE.NAME%TYPE ;
7 BEGIN
8 OPEN Cur_All ;
9 LOOP
10 FETCH Cur_All INTO v_Name ;
11 EXIT WHEN Cur_All%NOTFOUND;
12 DBMS_OUTPUT.PUT_LINE('SPOOL '||v_Name||'.txt') ;
13 DBMS_OUTPUT.PUT_LINE('SELECT TEXT FROM ALL_SOURCE WHERE NAME ='''||v_Name||''' ORDER BY LINE ;') ;
14 DBMS_OUTPUT.PUT_LINE('SPOOL OFF') ;
15 END LOOP;
16 CLOSE Cur_All;
17* END ;
SQL> /
SPOOL STANDARD.txt
SELECT TEXT FROM ALL_SOURCE WHERE NAME ='STANDARD' ORDER BY LINE ;
SPOOL OFF
PL/SQL procedure successfully completed.
SQL> Do spool of the above anonymous block. And run it as a SQL script. You will get required output.
Regards,
Arpit
Message was edited by:
arpit_shah4u -
Saving Functions, Packages and Stored Procedures in Tool
Hi,
I'm not sure what is going on - I've imported stored procedures, funtions and packages and they seem to get lost - is there something that I'm not doing correctly.
I'm using SQL Developer Data Modeler version 3.0.0.665.
Thanks for your help.Hi David,
The following error is reported in datamodeller.log
2011-07-15 14:41:52,152 [Thread-17] ERROR XMLTransformationManager - Unable to load object from XML: M:\DEV\PS-DESIGN\DM WORKING FOLDER\DM_SP\DM_SP\rel\ADC52B64-45F301457CE2\phys\32076570-BF29817DFF70\Package\seg_0\57F361C1-F09A-637C-58CD-FF3FB69D54AC.xml
java.io.FileNotFoundException: M:\DEV\PS-DESIGN\DM WORKING FOLDER\DM_SP\DM_SP\rel\ADC52B64-45F301457CE2\phys\32076570-BF29817DFF70\Package\seg_0\57F361C1-F09A-637C-58CD-FF3FB69D54AC.xml (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:106)
at oracle.dbtools.crest.model.metadata.XMLToObjectTransformer.transformToObject(Unknown Source)
at oracle.dbtools.crest.model.metadata.XMLTransformationManager.transformFromXMLToObject(Unknown Source)
at oracle.dbtools.crest.model.metadata.XMLTransformationManager.openPhysicalModel(Unknown Source)
at oracle.dbtools.crest.swingui.browser.BrowserPanel$78.run(Unknown Source)
But actually, the said xml is available in different folder ..\Package\seg_1 where DM is searching the file in ..\Package\seg_0
Actual File path
M:\DEV\PS-DESIGN\DM WORKING FOLDER\DM_SP\DM_SP\rel\ADC52B64-45F301457CE2\phys\32076570-BF29817DFF70\Package\seg_1\57F361C1-F09A-637C-58CD-FF3FB69D54AC.xml
The path of the file name is not getting stored properly, hence there packages are not loaded properly.
Regards
Sugirtha
Maybe you are looking for
-
IPod Touch 1st generation froze after upgraded to iOS 3.1.3
iPod Touch 1st generation froze after upgraded to iOS 3.1.3. iTunes 10.4.1 shows synced and current, but iPod frozen with logo and progress bar on screen. can anyone help? tnx.
-
Can't deinstall, restore or install iTunes
I've got a problem with deinstalling or restoring my old version of iTunes (7.0.0.70) when ever I try to deinstall or restore the old version I et an error saying: *invalid drive J:\* and after that an error saying something about an unrestorable fau
-
Connecting USB and another computer via wireless
Can I connect the printer to one computer via USB and another via wireless? This question was solved. View Solution.
-
My iphone5 got a problem of getting switched off and on automatically. I can see my screen getting faded and then i can see the pink vertical lines before it switches off. After about 10 seconds it switches on again.
-
Recipe for 'home movie' effect? Ideas?
FCP 5.0.4 Anybody got a quick recipe for making a clip look like old Super 8 home movie? Guessing frame rate around 12-18 fps or so, but how 'bout some way to add scratches and weave? Be nice if there were a plug in...or did I miss it? Can't recall i