Registering PL/SQL procedure in APPS with optional parameters
I want to register a PL/SQL procedure as follows in Oracle APPS.
Problem:
The procedure is to pick up employee details from a table.I need to pass empno as the parameter(or as an input) to the procedure.I want this parameter registered as an optional parameter. This means if I input a value to this parameter, then the procedure will pick up employee details for that empno. If I do not pass any value to this parameter, then procedure will pick employee details for all employees.
Also how can pass two optional parameters to pick employee details for a range of employee numbers?
Thanks
How are you calling your PL/SQL procedure and how are you planning on returning your results?
You don't actually need to have an optional parameter - you could simply pass a NULL value for the EmpNo parameter. If you do want to not reference the parameter at all you can provide a default in the parameter definition.
Assuming that you want to return your results as a cursor, you could do something like:
FUNCTION GetEmpDetails ( EmpNo_i IN VARCHAR2 DEFAULT NULL ) RETURN SYS_REFCURSOR;
Similar Messages
-
I am trying to create an XSQL page that has optional parameters.
What I mean is, I would like the page to return all records for a query when the following url is used http://myserver.com/my_inventory.xsql
And I would like the page to return limited records for a query when the following url is used http://myserver.com/my_inventory.xsql?item=123
I have been trying the following with no success. Any suggestions?
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="rowset2inventorylevel.xsl"?>
<xsql:if-param name="item" exists="no">
<xsql:query connection="myconn" tag-case="lower" xmlns:xsql="urn:oracle-xsql">
select m.item_no
, m.description
, m.qty_on_hand
, nvl(p.gross_wt,0) weight
from item_master m
, item_price p
where m.item_no = p.item_no
and m.status_flag='A'
and m.discontinue_flag = 'N'
order by m.item_no
</xsql:query>
</xsql:if-param>
<xsql:if-param name="item" exists="yes">
<xsql:query connection="myconn" tag-case="lower" xmlns:xsql="urn:oracle-xsql">
select m.item_no
, m.description
, m.qty_on_hand
, nvl(p.gross_wt,0) weight
from item_master m
, item_price p
where m.item_no = p.item_no
and m.status_flag='A'
and m.discontinue_flag = 'N'
and m.item_no = ?
order by m.item_no
</xsql:query>
</xsql:if-param>The easy, but less optimal way, is to use OR in your where clause:
rewrite "and m.item_no = ?" to "and m.item_no = ? or ? is null" - and remember to include the parameter twice in bind-params.
The "right" way to do this, meaning a more optimal access path, is to use stored procedures that returns REF CURSORs. Then in the stored procedure you look for NULL and change the where clause accordingly. -
Crystal Report with Optional Parameters from Stored Procedure
I have a client who created a Crystal Report. This report is linked to a Stored Procedure which allows for input on two criteria. Both of these critera are static values. However, the second of these parameters is setup to allow the user to enter up to 20 values. For example, the Stored Procedure needs the CARDCODE, and a set of DOCUMENTS. So the parameters/prompts would look like this...
BP CardCode:
Document1:
Document2:
Document3:
...etc...
The report will just display basic document information for those documents that were entered.
With 8.8, these parameters were changed to be REQUIRED.... not OPTIONAL. According to SAP note 1500777, this is a known bug and will be fixed in future versions. This note also states to change the criteria for the filter. However, when using a Stored Procedure, this does not appear to be an option, as the selection is defined by the data connection (and the parameters defined in the SP).
Am I missing something? Is there a way to make the suggetion in the above note work with my Stored Procedure?
Or, is there another way to make these parameters optional? (Do I need to change the SP?)
Thanks!
~ terry.I have a client who created a Crystal Report. This report is linked to a Stored Procedure which allows for input on two criteria. Both of these critera are static values. However, the second of these parameters is setup to allow the user to enter up to 20 values. For example, the Stored Procedure needs the CARDCODE, and a set of DOCUMENTS. So the parameters/prompts would look like this...
BP CardCode:
Document1:
Document2:
Document3:
...etc...
The report will just display basic document information for those documents that were entered.
With 8.8, these parameters were changed to be REQUIRED.... not OPTIONAL. According to SAP note 1500777, this is a known bug and will be fixed in future versions. This note also states to change the criteria for the filter. However, when using a Stored Procedure, this does not appear to be an option, as the selection is defined by the data connection (and the parameters defined in the SP).
Am I missing something? Is there a way to make the suggetion in the above note work with my Stored Procedure?
Or, is there another way to make these parameters optional? (Do I need to change the SP?)
Thanks!
~ terry. -
Looking for a simple Text App with options like columns, lists etc
I am looking for an app that lets me do simple things like type lists of things , create columns etc . PLEASE tell me that my Mac Pro with Snow Leopard already has the ability to do this somewhere and that i dont need to buy "iWork" or "Excell" to perform this basic function. Thanks
If you're talking about a simple word processor, then Bean (http://www.bean-osx.com/Bean.html) will be worth a look. It's simple, has the ability to create text columns, and best of all, is free!
NeoOffice (Mac port of OpenOffice) is fantastic if you need a complete Office suite (http://www.neooffice.org) - also free. Its spreadsheet app is called Calc.
Mac Mail and iCal can do 'To Do' lists, and there's also plenty of free apps that do simple to-do type lists.
When you mention 'lists' the app that comes to mind is OmniOutliner (http://www.omnigroup.com/applications/omnioutliner/) but it's not free. -
a file on my Numbers application is malfunctioning
Well, shucks, i just spent almost 30 minutes trying to find your model user guide to explain it better, I guess they never got around to making it.....
I would just borrow another Windows disk and try installing it again and if it does it again then you might take it to an Apple Store and see if one of the "Genius' " can figure it out.
Make sure your internet is enabled and click on your blank desktop and at the top of your screen is a Help menu option, enter PRAM and it should give you a list of things relating to Pram. It may take a few seconds to list anything as it has to connect to Apples severs first. It should list the things you may have to fill back in when your done.
"P-ram" stores some common information that is used in the background, your date, time, startup disk, etc, that you don't have to re-fill when you restart, it's a little different for each computer. -
Pl/sql procedure in package with out parameter
Hi all,
my need is to run procedure in package and return 0 or 1 as out parameter depending on data selection.
How do I return value?
My first guess is to use raise_application_error, but maybe some other decision can be found here.
Looking forward to see your reply.
Thanks ahead.Hi,
marco wrote:
Hi all,
my need is to run procedure in package and return 0 or 1 as out parameter depending on data selection.
How do I return value? Assign the desired value to the OUT parameter.
My first guess is to use raise_application_error, but maybe some other decision can be found here. You can do it in an EXCEPTION handler, if that makes sense.
Here's an example:
CREATE OR REPLACE PROCEDURE dept_comm
( in_deptno IN scott.emp.deptno%TYPE -- Department of interest
, out_comm OUT scott.emp.comm%TYPE -- Total comm in that department
, out_flag OUT NUMBER -- 0 means there were no rows in table, 1 means there were
AS
BEGIN
SELECT SUM (comm), COUNT (*)
INTO out_comm, out_flag -- See note (1) below
FROM scott.emp
WHERE deptno = in_deptno;
IF out_flag > 0 -- 0 and 1 are the only possible values for out_flag
THEN
out_flag := 1; -- See note (2) below
END IF;
END dept_comm;
/This shows out_flag getting set 2 different ways:
(1) in a SELECT ... INTO statement
(2) in a normal assignment statement
Any other way that you can use to assign a value to out_flag (such as passing it as an OUT argument to another procedure) would work as well.
Edited by: Frank Kulash on Jan 31, 2012 1:27 PM -
How to create default web service constructor with optional parameters in C#
hi senior :)
i tried to create a web services with a default constructor and another that takes few arguments, no matter
what i do I couldn't call the non default constructor from the client! how can I pass my arguments in the constructor? worse yet, I tried to pass my arguments to another exposed WebMethod, guess what? the public or private variables i'm trying to update,
do not get updated, what gives? any documentation on how to use web services? i'm pretty newbie at this. thankshttp://forums.asp.net/
You need to post to Web services section in the above forum. -
FND_REQUEST PL/SQL procedure with parameters
Hi guys
I have created a concurrent program, using PL/SQL procedure which has 2 in parameters. I am trying to call the concurrent program using
v_req_id :=FND_REQUEST.SUBMIT_REQUEST('INV','OMS_POP_INVVALUES_P',
NULL,SYSDATE,FALSE,l_on_date, l_org_id,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL
COMMIT;
However, the concurrent program always failing with
**Starts**26-AUG-2013 14:02:31 ORACLE error 6550 in FDPSTP Cause: FDPSTP failed due to ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'OMS_POP_INVVALUES_P' ORA-06550: line 1, column 7: PL/SQL: Statement ignored
and I doubt it is because the database procedure call is not proper.
I have set four parameters with the concurrent program, as they were with the procedure itself, which are
p_on_date IN DATE, p_org_id IN NUMBER, errbuff OUT VARCHAR2,retcode OUT VARCHAR2
Please help
regards,
rajOkay I fixed the problem by
1. Changing the order of parameters with Procedure like following
CREATE OR REPLACE PROCEDURE OMS_POP_INVVALUES_P (
errbuff OUT VARCHAR2,retcode OUT NUMBER, p_on_date IN DATE, p_org_id IN NUMBER)
IS
and then changing the concurrent program call like following
l_req_id :=
fnd_request.submit_request('INV','OMS_POP_INVVALUES_P',
NULL,SYSDATE,FALSE,l_in_date, l_org_id,CHR(0));
:SYSTEM.Message_Level := '25';
COMMIT;
after removing all the parameters from the program parameter list. No need to pass any value for errbuff and retcode, just pass other parameters and end the parameter list with CHR(0). Hope this is useful for somebody else out there.
Regards,
raj -
Debugging PL/SQL procedures with JDeveloper ?
Hi,
does anyone know if it is possible to debug PL/SQL procedures and packages with JDeveloper ? I'm using a 9.0.1.2.0 database but JDeveloper returns the error "The target VB_TEST could not be started because the database version does not support debugging." when I try to debug a PL/SQL procedure.
If it is not possible, does anyone know a good alternative ?Oracle Script Debugger is not available anymore at technet.I need to retrive data from PL/SQL stored procedures. I am using the DynamicSQL component (2nd workaround) to retrive data from PL/SQL stored procedures. <br><br>
I am having some problems.<br><br>
This is the code I am running in Fuego Studio 5.5 SP 11 Build #71108:<br><br>
dynamicSQL as Fuego.Sql.DynamicSQL<br>
iterator as Iterator(Any[Any])<br>
sentence as String<br>
implname as String<br><br>
dynamicSQL = Fuego.Sql.DynamicSQL()<br>
implname = "conexionORBPAU"<br>
sentence = "var result REFCURSOR; " + <br>
"exec :result_cursor := pkg_audbpm_bpaasig_indicador.prgetsingle(9999);";<br>
iterator = executeQuery(DynamicSQL, sentence, implname, inParameters : []);<br><br>
And, this is the error:<br><br>
java.sql.SQLException: Falta el parametro IN o OUT en el indice:: 1 <br>
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)<br> at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)<br>
oracle.jdbc.driver.OraclePreparedStatement.processCompletedBindRow(OraclePreparedStatement.java:1681)<br>
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3280)<br>
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3329)<br>
at fuego.jdbc.FaultTolerantPreparedStatement.executeQuery(FaultTolerantPreparedStatement.java:579)<br>
at fuegoblock.sql.DynamicSQL.executeQuery(DynamicSQL.java:340)<br>
...<br><br>
This is the code of the PL/SQL in the Oracle DB:<br><br>
CREATE OR REPLACE PACKAGE PKG_AUDBPM_BPAASIG_INDICADOR IS<br>
TYPE cursor_type IS REF CURSOR;<br>
FUNCTION prGetSingle<br>
(<br>
p_ID_ASIG_INDICADOR IN NUMBER<br>
)<br>
RETURN cursor_type;<br><br>
END PKG_AUDBPM_BPAASIG_INDICADOR;<br><br>
is my code OK? Any ideas?<br><br>
Thanks in advance.<br> -
How to create a function/procedure which can take optional parameter?
Hi,
I want to create a function or a procedure which can take optional parameters. For example, I want to create fun1() or fun1(param1) like this. Only one function will act differently when different number of parameters are passed to it. Something like the substr() function in oracle. It can be called with 2 parameters, as well as three parameters.
Thanks in advance,
KiranThere are two ways of doing this. The regular way would be to add a DEFAULT clause to your function declaration:
-- Function can be called with 1 or 2 parameters
FUNCTION xxxx
( param_one NUMBER
, param_two VARCHAR2 DEFAULT NULL )
RETURN VARCHAR2;Or, if your functions are declared in a package you can do some over-loading:
PACKAGE yyyy
IS
-- Function with 1 parameter
FUNCTION xxxx
( param_one NUMBER )
RETURN VARCHAR2;
-- Function with 2 parameters
FUNCTION xxxx
( param_one NUMBER
, param_two VARCHAR2 )
RETURN VARCHAR2;
END;If you are calling server-side functions from client-side tools (like OracleForms) you may need to use this second method. -
HANA procedure call n times with different parameters
Hi,
I am implementing some procedures on sql script and due to parallelization reasons i would like to call the same procedure n times with different parameters being the procedure name one of the parameters.
Which method would you advise me (xsjs, ...)?
Thanks in advanceThis is a known issue. We plan to have a fix in a future release but there is currently no ETA that I can share with you. I would recommend that you log an SR with support so that we can track the fact that this issue is affecting you.
Chris -
How do I register people on my contact list app with iMessage ? I have an iPad and a red balloon keeps on coming up asking if I want to remove the unregistered contact. How do I go about solving this problem?
Cynthia 215 wrote:
How do I register people on my contact list app with iMessage ?
You can't. They have to register to use Messages on their devices themselves. You cannot add them to your contacts yourself. After they have setup and registered Messages, then you can add them.
Messages only works with other iOS devices. You cannot message with an Android phone or a regular cell phone. -
How do I delete cascade with a PL/SQL procedure?
This script will create a PL/SQL procedure that deletes cascade. This is a post to contribute to the Oracle community. Take the code as is and test it before you use it in production. Make sure this is what you want.
Procedure Delete Cascade (prc_delete_cascade)
Description
=============
The principle is very simple. The procedure uses a table called TO_BE_DELETED to keep a list of records to be deleted. This
table keeps the table name and the rowid of those records that need to be deleted. The procedure also uses a function called
DELETE_BOTT_ROW which takes one record of the table and tries to delete it. If the deletion fails with a foreign key constraint
violation, the function parses the SQL error message (SQLERRM) to get the name of the constraint. With the name of the constraint,
the function finds the name of the child table, all the child records that have references to the parent table primary or unique key,
and the parent key primary or unique key column name. Once the child records of the failed delete are identified, the function takes their table name and rowids
and records them into the TO_BE_DELETED table by inserting records of their table name and their rowids. Al the records inserted also contain the level (which
is 1 for the original records, 2 for child records, 3 for granchild records, etc.) and the sequence number of the order in wich they
are recorded. This way, when the function picks up a record to be deleted, it takes the one with the highest level and the highest
inserted sequence, or the "bottom" record. Once all the child records of the failed delete are appended to the TO_BE_DELETED table, it calls itself
recursevely, and the function takes the record at the "bottom" of the table and tries to delete it. If it succeeds, it calls
itself recursevely to delete the next record. If it fails, it goes and finds the child records as described before and once they are
inserted into the TO_BE_DELETED table, it calls itself again recursevely to try to delete again the "bottom" record. All records
that are successfully deleted are flagged as deleted usig the flag_del column so they are not pickt up again. Once all the (parent,
child, grandchild, etc.) records are deleted, the procedure ends without commiting, giving the option to the user to commit or
rollback deletions. The table TO_BE_DELETED is, at the end of the procedure, a list of all the records that were deleted, including their table names
and the order in with they were deleted. The user then can review its content and decide to commit or rollback.
Restrictions
============
1. Single tables only. The procedure only takes one table name and a WHERE clause to identified the records to be deleted.
2. Single columns only. Ther procedure only works with single-column primary, unique and foreign key constraints.
3. Single schema only.
4. Unpredictable results with circular references.
drop table to_be_deleted purge;
create table to_be_deleted
(tname varchar2(30) -- table name
,rid rowid -- rowid
,lvl number -- level: 1=parent, 2=child, 3=grandchild, etc.
,seq_ins number -- sequence order of record inserted
,flg_del char -- flag deleted: Y=record deleted
,seq_del number -- global order of record deletion
set serveroutput on size 1000000
create or replace procedure prc_delete_cascade
(p_tname varchar2 -- table name
,p_where varchar2 -- where clause identifying records to be cascade deleted
is
dummy char;
v_sqlcode number;
v_sqlerrm varchar2(32767);
v_param_val integer := 0;
v_sql varchar2(4000);
v_ret_cde number;
e_bad_params exception;
v_iter number;
v_plvl number;
v_seq_del number;
v_max_iter number := 1000000000;
function delete_bott_row
return number
is
v_sql varchar2(4000);
v_ptname varchar2(30); -- parent table name
v_ppkname varchar2(30); -- parent primary key constraint name
v_ppkcname varchar2(30); -- parnet primary key column name
v_prowid rowid;
v_crowid rowid;
v_ctname varchar2(30); -- child table name
v_cfkname varchar2(30); -- child foreign key constraint name
v_cfkcname varchar2(30); -- child foreign key column name
v_ins number;
v_seq_ins number;
v_sqlerrm varchar2(4000);
v_sqlcode number;
e_const_viol exception;
pragma exception_init(e_const_viol, -2292);
e_max_iter_reached exception;
begin
v_iter := v_iter + 1;
if v_iter >= v_max_iter then
raise e_max_iter_reached;
end if;
dbms_output.put_line('- Iter '||to_char(v_iter));
dbms_output.put_line('----------');
dbms_output.put_line('- Starting function delete_bott_row');
v_sql := 'select tname, rid, lvl, seq_ins from (select * from to_be_deleted where flg_del = ''N'' order by lvl desc, seq_ins desc) where rownum=1';
-- dbms_output.put_line('- SQL: '||v_sql);
execute immediate v_sql into v_ptname, v_prowid, v_plvl, v_seq_ins;
dbms_output.put_line('- Selected row: table name: '||v_ptname||', level: '||v_plvl||', seq: '||v_seq_ins);
v_sql := 'delete from '||v_ptname||' where rowid='''||v_prowid||'''';
dbms_output.put_line('- SQL: '||v_sql);
execute immediate v_sql;
dbms_output.put_line('- Row deleted !!!');
v_ret_cde := 1;
v_seq_del := v_seq_del + 1;
dbms_output.put_line('- Mark the row deleted');
v_sql := 'update to_be_deleted set flg_del = ''Y'', seq_del = '||to_char(v_seq_del)||' where tname='''||v_ptname||''' and rid='''||v_prowid||'''';
-- dbms_output.put_line('- SQL: '||v_sql);
execute immediate v_sql;
-- dbms_output.put_line('- Updated table to_be_deleted, row marked deleted');
-- dbms_output.put_line('- End of iter '||to_char(v_iter));
dbms_output.put_line('----------');
-- call function delete_bott_row recursively
v_ret_cde := delete_bott_row;
return 0;
exception
when no_data_found then
dbms_output.put_line('- Table to_be_deleted is empty, delete cascade has completed successfully.');
v_ret_cde := 0;
return 0;
when e_const_viol then
v_sqlcode := SQLCODE;
v_sqlerrm := SQLERRM;
v_ret_cde := v_sqlcode;
dbms_output.put_line('>Constraint Violation. Record has children');
-- dbms_output.put_line('Error code: '||to_char(v_sqlcode));
v_cfkname := substr(v_sqlerrm,instr(v_sqlerrm,'.')+1,instr(v_sqlerrm,')') - instr(v_sqlerrm,'.')-1);
dbms_output.put_line('>Child FK name: '||v_cfkname);
select table_name, column_name
into v_ctname, v_cfkcname
from user_cons_columns
where constraint_name=v_cfkname;
dbms_output.put_line('>Child table name: '||v_ctname||'. FK column name: '|| v_cfkcname);
select constraint_name, column_name
into v_ppkname, v_ppkcname
from user_cons_columns
where constraint_name = (select r_constraint_name
from user_constraints
where constraint_name=v_cfkname);
dbms_output.put_line('>Parent PK/UK name: '||v_ppkname||'. Parent PK/UK column: '||v_ppkcname);
v_sql := 'insert into to_be_deleted(tname, rid, lvl, seq_ins, flg_del) '||
'select '''||v_ctname||''', rowid, '||to_char(v_plvl+1)||', rownum, ''N'' '||
'from '||v_ctname||' '||
'where '||v_cfkcname||' =any (select '||v_ppkcname||' from '||v_ptname||' where rowid =any (select rid from to_be_deleted where tname = '''||v_ptname||'''))';
-- dbms_output.put_line('- SQL: '||v_sql);
execute immediate v_sql;
select count(*)
into v_ins
from to_be_deleted
where lvl = v_plvl+1
and tname = v_ctname
and flg_del = 'N';
dbms_output.put_line('>Found '||to_char(v_ins)||' child records which were added to table to_be_deleted');
v_ret_cde := delete_bott_row;
return v_ret_cde;
when e_max_iter_reached then
dbms_output.put_line('Maximum iterations reached. Terminating procedure.');
raise;
when others then
raise;
end delete_bott_row;
begin
dbms_output.put_line('Beginning');
dbms_output.put_line('================================');
-- validate p_table
begin
select 'Y'
into dummy
from user_tables
where table_name=upper(p_tname);
exception
when no_data_found then
v_param_val := 1;
dbms_output.put_line('Table '||p_tname||' does not exist.');
raise e_bad_params;
end;
dbms_output.put_line('- Parameter p_tname validated');
-- validate p_where
begin
execute immediate 'select ''Y'' from '||p_tname||' where '||p_where INTO dummy;
exception
when no_data_found then -- where clause returns no records
dbms_output.put_line('Record(s) not found. Check your where clause parameter');
v_param_val := 2;
raise e_bad_params;
when too_many_rows then -- found multiple records means it is ok
null;
when others then -- any other records means where clause has something wrong.
dbms_output.put_line('Where clause is malformed');
v_param_val := 2;
raise e_bad_params;
end;
dbms_output.put_line('- Parameter p_where validated');
if v_param_val > 0 then raise e_bad_params; end if;
v_iter := 0;
v_plvl := 1;
v_seq_del := 0;
v_sql := 'insert into to_be_deleted(tname, rid, lvl, seq_ins, flg_del) select '''||upper(p_tname)||''', rowid, '||to_char(v_plvl)||', rownum, ''N'' from '||p_tname||' where '||p_where;
dbms_output.put_line('- Inserting initial record');
dbms_output.put_line('- SQL: '||v_sql);
execute immediate v_sql;
dbms_output.put_line('- Record(s) inserted');
dbms_output.put_line('- Calling function delete_bott_row to delete last row of table to_be_deleted');
dbms_output.put_line('-----------------------------------');
v_ret_cde := delete_bott_row;
-- dbms_output.put_line('- Back from function delete_bott_row');
-- dbms_output.put_line('Return code: '||to_char(v_ret_cde));
dbms_output.put_line('- End of procedure');
exception
when e_bad_params then
dbms_output.put_line('Bad parameters, exiting.');
end;
show errors
spool prc_delete_cascade.log
-- Call to the procedure
exec prc_delete_cascade('xent','xent_id between 1669 and 1670')
select tname "Table Name", count(*) "Rows deleted"
from to_be_deleted
group by tname;
spool off
set lines 120
select *
from to_be_deleted
order by seq_del;
prompt Now commit or rollaback deletions.
-- commit;
-- rollback;Edited by: Rodolfo4 on Mar 23, 2011 10:45 AMInteresting.
I see a few areas where this could be useful. Elimiating specific test records from a Test DB for example.
Some comments:
<li>Since this is a recursive logic you must add a stop criteria. In this case I would add a max iteration variable. If that one is reached, raise an error message and let the procedure stop with that error.</li>
<li>The when others exception at the end should be removed completely</li>
<li>The when others exception in the middle should be replaced by a specific exception that handles the -2292 error</li>
<li>A list of tables where no record should be deleted could be usefull. If the logic would encounter such a table, it should also stop. This would be to prevent that data from some system critical tables could be deleted per accident.</li>
<li>The reference from the FK constraint to the PK constraint should include the table name and if possible the owner (as long as you use user_* views the owner is always the same. But we could extend this to the ALL_* views). I never met a system where different tables have the identical FK constraint names, however just make this fool proof.</li> -
Radio button on a from generated with PL/SQL procedure
Hi,
I have a form generated with PL/SQL procedure. This procedure calls another procedure on 'Submit'. If I select value for the radio button, it works fine. But if no value is given to the radio button on the form, it gives error. Is the radio button mandatory field by nature? or do I need to give default value some how? How do I make the radio button optional? so that I can call the next procedure without passing the param.
Create or Replace PROCEDURE OBM_PROCEDURE
htp.formOpen(OWA_UTIL.GET_OWA_SERVICE_PATH || 'process_obm');
htp.Print('Admin ');
htp.FormRadio('p_access_level','A');
htp.Print('Doc ');
htp.FormRadio('p_access_level','D');
htp.formSubmit(cname=>'p_button', cvalue=> 'Submit');
=================================================================
Create or Replace PROCEDURE PROCESS_OBM
(p_access_level VARCHAR2,
p_button VARCHAR2)
htp.Print('p_access_level ');
Thanks!Hi
The parameters of the called procedure should have defualt values like this
create or Replace PROCEDURE PROCESS_OBM
(p_access_level VARCHAR2 default 1,
p_button VARCHAR2 default null
htp.Print('p_access_level ');
Thanks,
sharmila -
Registering with one iTunes account and buying apps with another...
Can you register a device to one account but purchase apps with another and if so...how can I do this?
We are using iPads at our school to compliment and enhance teaching- they belong to the school but we are exploring the option of using multiple IDs to access apps . I am trying to troubleshoot potential problems before rollout.
Maybe you are looking for
-
Cannot see my external hard drive on the desktop
Hi, I am at the tail end of a large documentary project on FCP. Suddenly, this evening my external hard drive (Maxtor One Touch III, Turbo Edition, 1.5TB) becomes sluggish. I shut down (all properly) and restart and the external hard drive is no long
-
Mail with either no content or just plain "gibberish"
Getting mail on my iPhone 4 that is either no content or is a bunch of disconnected words and/ or sentences. Any suggestions to block? or eliminate?
-
Does anyone here know anything about parental controls?
Hey guys! I am an incoming college student, so I recently purchased a shiny new Macbook Pro (which I love!). However, i have an issue. My mother is something of a paranoid android, and wants to install some kind of parental controls. While I really d
-
Microsoft SQL server 2012 express
i recently downloaded ENU\x86\SQLEXPR_x86_ENU.exe and ENU\x86\SQLManagementStudio_x86_ENU.exe from microsoft SQL server 2012 from official download centre page. First i installed SQLEXPR_x86 (database engine) with mixed mode authentication, then i
-
Hello Guys, I'm trying to figure out if my harddrive is going bad in my system. I'm seeing a lot of SCSI transport error messages in the /var/adm/messages file. This only happens when our backups are running at night. We back up all our servers throu