How to modify a stored procedure?
How can I safely change the procedure:
PROCEDURE check_background_event ( TableName VARCHAR2 ,
StatusVal VARCHAR2 ,
KeyVal NUMBER ,
EventString VARCHAR2 ) IS
StartPos NUMBER ;
EndPos NUMBER ;
Param VARCHAR2 ( 255 ) ;
BEGIN
StartPos := INSTR ( EventString , '(' || StatusVal ) ;
EndPos := INSTR ( EventString , ')' , StartPos ) ;
IF StartPos > 0 AND EndPos > StartPos THEN
Param := SUBSTR ( EventString , StartPos + 3 , EndPos - StartPos - 3 ) ;
-- Check if this event should be logged
record_notes ( TableName , StatusVal , KeyVal , Param ) ;
INSERT INTO background
( background_id , priority , session_id ,
background_task_type_id , parameter , active )
SELECT
sq_background . nextval , 1 , lims_env . session_id ,
background_task_type_id , TableName || ',' || TO_CHAR ( KeyVal ) || ',' || Param , 'F'
FROM background_task_type
WHERE name = 'Event' ;
END IF ;
END check_background_event ;into:
PROCEDURE check_background_event ( TableName VARCHAR2 ,
StatusVal VARCHAR2 ,
KeyVal NUMBER ,
EventString VARCHAR2 ) IS
StartPos NUMBER ;
EndPos NUMBER ;
Param VARCHAR2 ( 255 ) ;
u_Prio NUMBER ;
BEGIN
StartPos := INSTR ( EventString , '(' || StatusVal ) ;
EndPos := INSTR ( EventString , ')' , StartPos ) ;
IF StartPos > 0 AND EndPos > StartPos THEN
Param := SUBSTR ( EventString , StartPos + 3 , EndPos - StartPos - 3 ) ;
-- Check if this event should be logged
record_notes ( TableName , StatusVal , KeyVal , Param ) ;
IF INSTR(TableName ,'P') = 1 THEN
u_Prio := 1 ;
ELSE
u_Prio := 3 ;
END IF ;
INSERT INTO background
( background_id , priority , session_id ,
background_task_type_id , parameter , active )
SELECT
sq_background . nextval , u_Prio , lims_env . session_id ,
background_task_type_id , TableName || ',' || TO_CHAR ( KeyVal ) || ',' || Param , 'F'
FROM background_task_type
WHERE name = 'Event' ;
END IF ;
END check_background_event ;
It is also a procedure.
CREATE OR REPLACE PACKAGE lims_status AS
PROCEDURE check_study_status ( KeyValue NUMBER , StatusValue VARCHAR2 ) ;
PROCEDURE check_sdg_status ( KeyValue NUMBER , StatusValue VARCHAR2 ) ;
PROCEDURE check_sample_status ( KeyValue NUMBER , StatusValue VARCHAR2 ) ;
PROCEDURE check_parentaliquot_status ( KeyValue NUMBER , StatusValue VARCHAR2 , IgnoreFlag BOOLEAN DEFAULT FALSE ) ;
PROCEDURE check_aliquot_status ( KeyValue NUMBER , StatusValue VARCHAR2 ) ;
PROCEDURE check_test_status ( KeyValue NUMBER , StatusValue VARCHAR2 ) ;
PROCEDURE check_parentplate_status ( KeyValue NUMBER , StatusValue VARCHAR2 , IgnoreFlag BOOLEAN DEFAULT FALSE ) ;
PROCEDURE check_plate_status ( KeyValue NUMBER , StatusValue VARCHAR2 ) ;
PROCEDURE check_plate_plan_status ( KeyValue NUMBER , StatusValue VARCHAR2 ) ;
PROCEDURE reset_current_transaction ;
PROCEDURE propagate_study_status ;
PROCEDURE propagate_sdg_status ;
PROCEDURE propagate_sample_status ;
PROCEDURE propagate_aliquot_status ;
PROCEDURE propagate_parentaliquot_status ;
PROCEDURE propagate_test_status ;
PROCEDURE propagate_parentplate_status ;
PROCEDURE propagate_plate_status ;
PROCEDURE propagate_plate_plan_status ;
-- Procedures call from workflows to continue authorisation propagation
PROCEDURE force_propagate_sample ( KeyValue NUMBER ) ;
PROCEDURE force_propagate_aliquot ( KeyValue NUMBER ) ;
PROCEDURE force_propagate_test ( KeyValue NUMBER ) ;
PROCEDURE force_propagate_result ( KeyValue NUMBER ) ;
PROCEDURE force_propagate_plate ( KeyValue NUMBER ) ;
-- Add events to the background queue
PROCEDURE check_background_event ( TableName VARCHAR2 , StatusVal VARCHAR2 , KeyVal NUMBER , EventString VARCHAR2 ) ;
-- Record notes for an entity
PROCEDURE record_notes ( TableName VARCHAR2 , StatusVal VARCHAR2 , KeyVal NUMBER , EventString VARCHAR2 ) ;
FUNCTION update_old_status ( OldStatus VARCHAR2 , NewStatus CHAR , CurrentStatus CHAR ) RETURN VARCHAR2 ;
-- Status changing procedures
PROCEDURE unapprove_sample ( SampleId NUMBER ) ;
PROCEDURE unapprove_plate ( PlateId NUMBER ) ;
PROCEDURE unapprove_plate_plan ( PlatePlanId NUMBER) ;
PROCEDURE complete_study ( StudyId NUMBER ) ;
PROCEDURE complete_sdg ( SdgId NUMBER ) ;
PROCEDURE complete_sample ( SampleId NUMBER ) ;
PROCEDURE complete_aliquot ( AliquotId NUMBER ) ;
PROCEDURE complete_test ( TestId NUMBER ) ;
PROCEDURE complete_plate ( PlateId NUMBER ) ;
PROCEDURE complete_plate_plan ( PlatePlanId NUMBER ) ;
-- Update the replicate count on tests
PROCEDURE check_test_replicates ( AliquotId NUMBER ) ;
PROCEDURE check_platetest_replicates ( PlateId NUMBER ) ;
PROCEDURE check_transaction ;
-- Procedure and Function to control Aliquot Authorisation
PROCEDURE add_aliquot_propagation ( KeyValue NUMBER ) ;
FUNCTION aliquot_propagated ( KeyValue NUMBER ) RETURN BOOLEAN ;
-- Procedures and Functions to control Number of Recursive Calls
PROCEDURE start_post_aliquot_call ;
PROCEDURE start_post_plate_call ;
PROCEDURE end_post_aliquot_call ;
PROCEDURE end_post_plate_call ;
FUNCTION needs_stop_post_aliquot RETURN BOOLEAN ;
FUNCTION needs_stop_post_plate RETURN BOOLEAN ;
study_propagating BOOLEAN := FALSE ;
sdg_propagating BOOLEAN := FALSE ;
sample_propagating BOOLEAN := FALSE ;
parentaliquot_propagating BOOLEAN := FALSE ;
aliquot_propagating BOOLEAN := FALSE ;
test_propagating BOOLEAN := FALSE ;
parentplate_propagating BOOLEAN := FALSE ;
plate_propagating BOOLEAN := FALSE ;
plate_plan_propagating BOOLEAN := FALSE ;
-- Variables to control Number of Recursive Call
stop_aliquot_propagating BOOLEAN := FALSE ;
stop_plate_propagating BOOLEAN := FALSE ;
-- Variables to control Complete status propagation
study_from_propagate NUMBER := 0 ;
sdg_from_propagate NUMBER := 0 ;
sample_from_propagate NUMBER := 0 ;
aliquot_from_propagate NUMBER := 0 ;
plate_from_propagate NUMBER := 0 ;
plate_plan_from_propagate NUMBER := 0 ;
END lims_status ;
Similar Messages
-
How to modify oracle stored procedure for JDBC Receiver Adapter?
Hi all.
This is Urgent.
Scenario is
SELECT a TABLE with procedure and update column with it,
then send data to SAP System with RFC Adapter.
When I executed a sync bpm, scenario was finished internal error.
Pls, let me know how to correct procedure using JDBC Receiver Adapter?
Regrds all.
Procedure Code -
SET SERVEROUTPUT ON
CREATE OR REPLACE PROCEDURE zwtn2
IS
v_seller_company wtnivhd.seller_company%TYPE;
v_invoice_no wtnivhd.invoice_no%TYPE;
v_report_date wtnivhd.report_date%TYPE;
v_customs_date wtnivhd.customs_date%TYPE;
v_ap_post_date wtnivhd.ap_post_date%TYPE;
v_gr_date wtnivhd.gr_date%TYPE;
CURSOR l_cursor IS
SELECT seller_company,
invoice_no,
report_date,
customs_date,
ap_post_date,
gr_date
FROM wtnivhd
WHERE wtn_send_flag = 'N'
AND rownum < 31
FOR UPDATE;
BEGIN
OPEN l_cursor;
LOOP
FETCH l_cursor
INTO v_seller_company,
v_invoice_no,
v_report_date,
v_customs_date,
v_ap_post_date,
v_gr_date;
EXIT WHEN l_cursor%NOTFOUND;
UPDATE wtnivhd
SET wtn_send_flag = 'Y'
WHERE CURRENT OF l_cursor;
END LOOP;
CLOSE l_cursor;
END zwtn2;Hi Alex,
plz have a look to Runtime Workbench / Adapter Monitoring to find an error message.
Regards,
Udo -
How to use a stored procedure as a datasource in Crystal Report for Eclipse
Hi All,
I've written a stored procedure in oracle 10g with few input parameters and one refcursor output parameter. I want to use this stored procedure as a data source for creating a report in "Crystal Report For Eclipse 3.6.0".
When I tried to add this stored procedure to the report using the connection explorer, I don't see any option to do this. But when I try to add any table, it shows options like "Add to the current report"....
Can anybody assist me how to use a stored procedure as a data source in "Crystal Report For Eclipse"?
Which driver should I use to connect to the oracle database? I tried using JDBC Driver for Oracle.
Thanks in advance.Did you solve your problem? How did you do?
-
How can I execute Stored Procedures in PARALLEL and DYNAMICALLY ?
Hi
I have a stored procedure. It can be executed like this
exec test @p = 1;
exec test @p = 2
exec test @p = n;
n can be hundred.
I want the sp being executed in parallel, not sequence. It means the 3 examples above can be run at the same time.
If I know the number in advance, say 3, I can create 3 different Execution SQL Tasks. They can be run in parallel.
However, the n is not static. It is coming from a table.
How can I execute Stored Procedures in PARALLEL and DYNAMICALLY ?
I think about using script task. In the script, I get the value of n, and the list of p, from the table, then running a loop with. In the loop, I create a threat and in the threat, I execute the sp like : exec test @p = p. So the exec test may
be run parallel. But I am not sure if it works.
Any idea is really appreciated.Hi nam_man,
According to your description, you want to call stored procedures in parallel, right?
In SSIS, we can create separate jobs with different stored procedures, then set the same schedule to kick the jobs off at the same time. In this way, we should be careful to monitor blocking and deadlocking depending on what the jobs are doing.
We can also put all stored procedures in SSIS Sequence container, then they will be run in parallel.
For more information about SSIS job and Sequence container, please refer to the following documents:
http://www.mssqltips.com/sqlservertutorial/220/scheduling-ssis-packages-with-sql-server-agent/
https://msdn.microsoft.com/en-us/library/ms139855(v=sql.110).aspx
If you have any more questions, please feel free to ask.
Thanks,
Wendy Fu
Wendy Fu
TechNet Community Support -
How to call a stored procedure from WorkShop
Hello Everyone .. I'm quite new with WebLogic 8.1 & WorkShop, so please bare with
me .. Today I'm simply trying to find out how to call a stored procedure from
within workshop, using any of the DB Controls .. I see workshop provides a way
create a Java Control, Rowset Control, but it wont easily allow for a stored procedured
to be entered in place of the inline query .. Perhaps I've over looked it. Any
advise on the best way to tackle this task will be appreciated.
AtahualpaAtahualpa--
Maybe this will help:
http://edocs.bea.com/workshop/docs81/doc/en/workshop/guide/controls/database/conStoredProcedures.html
Eddie
Atahualpa wrote:
Hello Everyone .. I'm quite new with WebLogic 8.1 & WorkShop, so please bare with
me .. Today I'm simply trying to find out how to call a stored procedure from
within workshop, using any of the DB Controls .. I see workshop provides a way
create a Java Control, Rowset Control, but it wont easily allow for a stored procedured
to be entered in place of the inline query .. Perhaps I've over looked it. Any
advise on the best way to tackle this task will be appreciated.
Atahualpa -
How to use a stored procedure in oracle reports
How to use a stored procedure in oracle reports
Dear,
In report triggers you can write your procedure/functions or call it like
function AfterPForm return boolean is
begin
myprocedure(:mydate);
return (TRUE);
end;
Thanks
Jamil -
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 call a stored procedure using its package name in Oracle
hi
we're doing a JDBC scenario where we call a stored procedure(a.prc) using its package name(b)The stored procedure has In /Out/IN-OUT parameter.
i have got 2 queries:
1- How to call the stored procedure using it's package.
2- How to capture the In/Out parameter in the response.hi Prateek
thanks for the reply.
However when i tried mapping it to Package.procedure, communication channel throws the error saying that Package.proceudre needs to be declared.
As i said , the procedure has IN-OUT parameter too.In oracle we need to write a block if we want to read the IN-OUT parameter.
How to get the IN-OUT parameter in XI? -
How to introspect a Stored Procedure in BPm 10g
Could some give points on how to introspect the Stored procedure from BPM
Hi,
I hope you must have created DB connection in External Resources (Workspace).
So Now create one module in catalog component called DBTables, right click on the module -> New -> Catalog Component -> SQL Query -> Select the DB connection that you created earlier -> select the schema, now you can see all the procedure, tables, function that are defined in your schema.Click on the procedure that you want to import to your workspace and click on finish. The procedure will be imported to your workspace.
Hope the above will help you.
Bibhu
Edited by: Bibhuti Bhusan on Jul 14, 2011 10:44 PM -
How to execute a stored procedure/function in TOAD?
Hi, All ,
Can someone please tell me how to execute a stored procedure/function in TOAD?
I have tired
EXECUTE PROCEDURENAME(888), but it doesn’t work.
TOAD give me the error: invalid SQL statement.
Thanks a lotWrite PL/SQl block.
i.e Begin
Procedure name..
end;
Then it will be excuted.
Ashutosh -
How do write a stored Procedure in PL/SQL
Hi,
I am new to this forum. I am creating a webpage using Gridview in Visual Studio 2005.
How to write a Stored procedure in Oracle using PL/SQL?
I want to write a SP for the following query :
"Select S_No, Task_ID,Last_Act_Dt,Last_Act_Tm,Status from E002 Order by S_No"
Please help.In Oracle, you normally wouldn't create a stored procedure that just does a query. Depending on what you're attempting to do on the client side, and the client libraries involved, you may be able to write a stored procedure that returns a REF CURSOR and call that. This will put some limitations on what the client can do with the results, for example. The data would be read-only and scrolling back and forth in the result set would potentially rather slow and rather expensive in terms of client memory. That makes this generally a somewhat unattractive option.
You could create a view in Oracle and just query the view in your application code. If you needed to change the query, you could then just change the view.
Justin -
I would like to prevent any user including admins from modifying a stored procedure
I would like to prevent any user including admins (apart from myself) from modifying a stored procedure.
I cant use encryption because i need people to be able to read the code, I cant use trigger because we arent able to add triggers to system tables.
Any ideas?You cannot prevent from the logins who are members of sysadmin role to modify stored procedures.
If you DENY ALTER SCHEMA then the user won't be able to issue any DDL changes (CREATE, ALTER, DROP) that affect objects in that schema
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
Need an Example for How to call a Stored Procedure using DBAdapter
Hi
I am trying to invoke a stored procedure in Oracle Database using DB Adapter. I have successfully invoked and when i try to run it i got the following error.
oracle.sysman.emSDK.webservices.wsdlapi.SoapTestException: Client received SOAP Fault from server : Exception occured when binding was invoked.
Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'ExecuteScript' failed due to:
Stored procedure invocation error.
Error while trying to prepare and execute the RESONANCEDEMO.SP_QUERY API.
An error occurred while preparing and executing the RESONANCEDEMO.SP_QUERY API. Cause: java.sql.SQLSyntaxErrorException: ORA-00917: missing comma
ORA-06512: at "RESONANCEDEMO.SP_QUERY", line 7
ORA-06512: at line 1
Check to ensure that the API is defined in the database and that the parameters match the signature of the API.
This exception is considered not retriable, likely due to a modelling mistake.
To classify it as retriable instead add property nonRetriableErrorCodes with value "-917" to your deployment descriptor (i.e. weblogic-ra.xml).
To auto retry a retriable fault set these composite.xml properties for this invoke: jca.retry.interval, jca.retry.count, and jca.retry.backoff.
All properties are integers.
I am trying to have a Out Parameter in my Procedure. Please provide me an example on how to invoke a Stored Procedure using Out Paramter using DB Adapter.Hi,
It looks more like an Oracle error and not within the DbAdapter.
Try to test first your procedure from PL/SQL or other developer you are using.
Arik -
How to incorporate a Stored procedure with ARD file (ADD ON)
hi experts
i created a SP which is called by the following code.
Dim GD As SAPbouiCOM.Grid
Dim Query As String = "exec sp_Attendance_Report'" & vmonth & "','" & vyear & "'"
GD = objForm.Items.Item("10").Specific
GD.DataTable.ExecuteQuery(Query)
while creating add on (ard file )how to incorporate this stored procedure?
thanks in advanceHello
When the addon first time connect, you must check that the SP is exists or not exists in target database. If not exist, you may create it.
sql to check the sp exists
select 1 from sysobjects where name like 'sp_Attendance_Report'
if this query returns 1 the sp is exists in the database, skip installation, if returns no records, you must install the sp via recordset by create procedure command.
Regards
János -
How to call a stored procedure from EJB3/toplink essentials..?
Hi,
I want to call a stored procedure residing in the oracle 10 g Database from my application's data access layer, which is designed using EJB3/toplink essentials.
I think this feature is not available right now in the EJB3 spec...any workaround with code if possible will be very help full...
Thanks & Regards,
SarveshThis should help you....
how to execute a stored procedure from ejb3.0 bean using entity manager
Maybe you are looking for
-
Color correction filter and keyframes
After lots of projects in FCE, I should know this! I have a clip with a color correction filter and keyframes at either end of the clip. Question: If I break the clip in two, am I correct that the color correction filter and keyframes are no longer s
-
Convert mpeg videos without changing original date
Hi I'm trying to convert my mpeg videos to mp4 or other, so as i can import them to iphoto and display them in a slideshow. i want to play the videos and photos (jpegs) in the sequence they have been taken, so i would need to keep the original date a
-
Hi, I am using a bean called productTransfer in two different JSP's: JSP 1: <jsp:useBean id="transferbean" class="transactions.productTransfer" scope="session"/> JSP 2: <jsp:useBean id="invTransfer" class="transactions.productTransfer" scope="session
-
Lightroom 3.2 catalog export failure "Photo previews could not be found"
I just attempted to use File > Export as Catalog... on my notebook. After the export completed a message was generated that reported Photo previews could not be found. (997) and listed all of the missing previews. I reviewed a random sample of the l
-
Dear All, What is ABAP-HR? How to work on it... ABAP task? any good material for ABAP-HR? regards, Dharmesh