[Resolved]VO on Ref Cursor - attempt to save = RowNotFoundException
I have a view object created from a ref cursor following 27.8.4 in the Oracle Application Development Framework Developer's Guide for Forms/4GL Developers. Using JDev 10.1.2 (yes, old version, but is consistent with all applications on current app server.) following the example at http://www.oracle.com/technology/obe/obe9051jdev/ADFWorkshop/BuildingADFApplicationsWorkshop.htm
I have a simple table with edit and delete columns on each row. The delete calls an onDelete() method in the browse...Action.java which calls a delete PL/SQL routine. Works great!
Now the edit calls a form for editing, just like in the OBE.
In the edit form, I change the displayname input field.
Press submit, get RowNotFoundException
press submit again, no errror
press save - goes back to the table and everything looks great.
So, what is causing the error, and how can I get this to work on the first press of the save button?
EditNewslineArchiveAction.onSave()
public void onSave(DataActionContext ctx) {
System.out.println("*** EditApplicantAction.onSave() ***");
DCBindingContainer bindings = ctx.getBindingContainer();
DCControlBinding binding;
// For fun, get the current row, and display the key
try {
// Get a reference to the currentRow()
DCIteratorBinding dcIter = bindings.findIteratorBinding("SearchRefCursor1Iterator");
Row r = dcIter.getCurrentRow();
System.out.println("Current Row.key = " + r.getKey().toStringFormat(true));
} catch (Exception e) {
System.out.println(e.getMessage() );
e.printStackTrace(System.out);
// get values from form
binding = bindings.findCtrlBinding("Masterid");
String masterId;
masterId = (binding != null) ? binding.toString() : "";
System.out.println("masterId = " + masterId);
binding = bindings.findCtrlBinding("DisplayName");
String displayName;
displayName = (binding != null) ? binding.toString() : "";
System.out.println("displayName = " + displayName);
if (!(masterId == null)) {
BindingContext bc = ctx.getBindingContext();
DCDataControl dc = bc.findDataControl("NewslineArchiveServiceDataControl");
NewslineArchiveService service = (NewslineArchiveService)dc.getDataProvider();
service.updateNewslineArchiveItem(masterId,displayName);
ctx.setActionForward(ctx.getActionMapping().findForward("Save"));
* if (ctx.getEventActionBinding() != null) {
* ctx.getEventActionBinding().doIt();
The onSubmit method just gets a reference to the current row and displays the value in a try catch block.
There is a onCancel method that sets an action forward, and goes back to the table page view.
Here is the output from the OC4J window. The "row.key =" is located in the createRowFromResultSet method. The "Current Row.key =" is in both the EditNewslineArchiveAction.onSave() and EditNewslineArchiveAction.onSubmit() methods.
[Starting OC4J using the following ports: HTTP=8988, RMI=23891, JMS=9227.]
C:\jdev1012\jdev\system10.1.2.2.0.1929\oc4j-config>
C:\j2sdk1.4.2_09\bin\javaw.exe -client -classpath C:\jdev1012\j2ee\home\oc4j.jar;C:\jdev1012\jdev\lib\jdev-oc4j.jar -Xverify:none -Ddisable.checkForUpdate=true -Doracle.j2ee.dont.use.memory.archive=true -Doracle.j2ee.http.socket.timeout=500 -Doracle.dms.sensors=NONE -Doc4j.jms.usePersistenceLockFiles=false com.evermind.server.OC4JServer -config C:\jdev1012\jdev\system10.1.2.2.0.1929\oc4j-config\server.xml
[waiting for the server to complete its initialization...]
07/05/07 14:39:27 Auto-deploying file:/C:/jdev1012/jdev/mywork/NewslineArchive/ViewController/public_html/ (New server version detected)...
Ready message received from Oc4jNotifier.
Embedded OC4J startup time: 2404 ms.
Target URL -- http://10.141.146.47:8988/NewslineArchive/jsps/index.jsp
07/05/07 14:39:28 Oracle Application Server Containers for J2EE 10g (10.1.2.2.0) initialized
May 7, 2007 2:39:28 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true
May 7, 2007 2:39:28 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.action.ActionResources', returnNull=true
May 7, 2007 2:39:29 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='newslinearchive.view.ApplicationResources', returnNull=true
May 7, 2007 2:39:29 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
May 7, 2007 2:39:29 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
May 7, 2007 2:39:29 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true
May 7, 2007 2:39:29 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.taglib.bean.LocalStrings', returnNull=true
07/05/07 14:39:35 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA897800000001000001126844BC10
07/05/07 14:39:35 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000303A4877800000002000001126844BC10
07/05/07 14:39:35 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA6F7800000003000001126844BC10
07/05/07 14:39:35 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA717800000004000001126844BC10
07/05/07 14:39:35 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA737800000005000001126844BC10
07/05/07 14:39:35 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA757800000006000001126844BC10
07/05/07 14:39:35 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA777800000007000001126844BC10
07/05/07 14:39:35 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA797800000008000001126844BC10
07/05/07 14:39:35 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA7D7800000009000001126844BC10
07/05/07 14:39:35 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA83780000000A000001126844BC10
07/05/07 14:39:35 getQueryHitCount returns the value: 12
07/05/07 14:39:35 EditApplicantAction.prepareModel() - No events
07/05/07 14:39:35 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA89780000000B000001126844BC10
07/05/07 14:39:35 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000303A487780000000C000001126844BC10
07/05/07 14:39:35 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA6F780000000D000001126844BC10
07/05/07 14:39:35 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA71780000000E000001126844BC10
07/05/07 14:39:35 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA73780000000F000001126844BC10
07/05/07 14:39:35 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA757800000010000001126844BC10
07/05/07 14:39:35 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA777800000011000001126844BC10
07/05/07 14:39:35 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA797800000012000001126844BC10
07/05/07 14:39:35 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA7D7800000013000001126844BC10
07/05/07 14:39:35 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA837800000014000001126844BC10
May 7, 2007 2:39:35 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
May 7, 2007 2:39:36 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
07/05/07 14:39:36 getQueryHitCount returns the value: 12
07/05/07 14:39:39 *** EditNewslineArchiveAction.prepareModel() - before super call
07/05/07 14:39:39 *** EditNewslineArchiveAction.prepareModel() - after super call
07/05/07 14:39:39 *** EditNewslineArchiveAction.findForward() - before super call
07/05/07 14:39:39 *** EditNewslineArchiveAction.findForward() - after super call
May 7, 2007 2:39:39 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
07/05/07 14:39:44 *** EditNewslineArchiveAction.prepareModel() - before super call
07/05/07 14:39:44 *** EditNewslineArchiveAction.prepareModel() - after super call
oracle.jbo.RowNotFoundException: JBO-25020: View row of key oracle.jbo.Key[238727 ] not found in SearchRefCursor1.
at oracle.jbo.server.remote.RuntimeViewRowSetIteratorInfo.getRowFromKey(RuntimeViewRowSetIteratorInfo.java:505)
at oracle.jbo.server.remote.RuntimeViewRowSetIteratorInfo.getRowForSvcMsg(RuntimeViewRowSetIteratorInfo.java:471)
at oracle.jbo.server.remote.RuntimeViewRowSetIteratorInfo.processChanges(RuntimeViewRowSetIteratorInfo.java:367)
at oracle.jbo.server.remote.AbstractRemoteApplicationModuleImpl.postRows(AbstractRemoteApplicationModuleImpl.java:3433)
at oracle.jbo.server.remote.AbstractRemoteApplicationModuleImpl.processSvcMsgRequest(AbstractRemoteApplicationModuleImpl.java:3480)
at oracle.jbo.server.remote.AbstractRemoteApplicationModuleImpl.processSvcMsgEntries(AbstractRemoteApplicationModuleImpl.java:4129)
at oracle.jbo.server.remote.AbstractRemoteApplicationModuleImpl.readServiceMessage(AbstractRemoteApplicationModuleImpl.java:3389)
at oracle.jbo.server.remote.AbstractRemoteApplicationModuleImpl.processMessage(AbstractRemoteApplicationModuleImpl.java:1859)
at oracle.jbo.server.ApplicationModuleImpl.doMessage(ApplicationModuleImpl.java:7355)
at oracle.jbo.server.remote.AbstractRemoteApplicationModuleImpl.sync(AbstractRemoteApplicationModuleImpl.java:1825)
at oracle.jbo.server.remote.colo.ServerApplicationModuleImpl.doMessage(ServerApplicationModuleImpl.java:263)
at oracle.jbo.common.colo.ColoApplicationModuleImpl.doMessage(ColoApplicationModuleImpl.java:103)
at oracle.jbo.client.remote.ApplicationModuleImpl.doMessage(ApplicationModuleImpl.java:6375)
at oracle.jbo.client.remote.PooledRequestHandler.doMessage(PooledRequestHandler.java:130)
at oracle.jbo.client.remote.ApplicationModuleImpl.doMessage(ApplicationModuleImpl.java:6375)
at oracle.jbo.client.remote.ApplicationModuleImpl.sendServiceMessage(ApplicationModuleImpl.java:1100)
at oracle.jbo.client.remote.ApplicationModuleImpl.sendServiceMessage(ApplicationModuleImpl.java:1114)
at oracle.jbo.client.remote.ApplicationModuleImpl.sendWorkingSetRequests(ApplicationModuleImpl.java:3497)
at oracle.jbo.common.ws.WSApplicationModuleImpl.sendRequests(WSApplicationModuleImpl.java:1119)
at oracle.jbo.client.remote.ApplicationModuleImpl.sendRequest(ApplicationModuleImpl.java:1148)
at oracle.jbo.client.remote.ApplicationModuleImpl.validate(ApplicationModuleImpl.java:810)
at oracle.adf.model.bc4j.DCJboDataControl.validate(DCJboDataControl.java:967)
at oracle.adf.model.binding.DCBindingContainer.validateInputValues(DCBindingContainer.java:1683)
at oracle.adf.controller.lifecycle.PageLifecycle.validateModelUpdates(PageLifecycle.java:465)
at oracle.adf.controller.struts.actions.DataAction.validateModelUpdates(DataAction.java:327)
at oracle.adf.controller.struts.actions.DataAction.validateModelUpdates(DataAction.java:519)
at oracle.adf.controller.lifecycle.PageLifecycle.handleLifecycle(PageLifecycle.java:115)
at oracle.adf.controller.struts.actions.DataAction.handleLifecycle(DataAction.java:222)
at oracle.adf.controller.struts.actions.DataAction.execute(DataAction.java:153)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16)
at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:239)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:669)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:340)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:285)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:126)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
at java.lang.Thread.run(Thread.java:534)
07/05/07 14:39:44 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA897800000015000001126844E401
07/05/07 14:39:44 *** EditNewslineArchiveAction.findForward() - before super call
07/05/07 14:39:44 *** EditNewslineArchiveAction.findForward() - after super call
07/05/07 14:39:46 *** EditNewslineArchiveAction.prepareModel() - before super call
07/05/07 14:39:46 *** EditNewslineArchiveAction.prepareModel() - after super call
07/05/07 14:39:46 *** EditApplicantAction.onSubmmit() ***
07/05/07 14:39:46 Current Row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000303A487780000000C000001126844BC10
07/05/07 14:39:46 *** EditNewslineArchiveAction.findForward() - before super call
07/05/07 14:39:46 *** EditNewslineArchiveAction.findForward() - after super call
07/05/07 14:39:48 *** EditNewslineArchiveAction.prepareModel() - before super call
07/05/07 14:39:48 *** EditNewslineArchiveAction.prepareModel() - after super call
07/05/07 14:39:48 *** EditApplicantAction.onSave() ***
07/05/07 14:39:48 Current Row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000303A487780000000C000001126844BC10
07/05/07 14:39:48 masterId = 238727
07/05/07 14:39:48 displayName = test
07/05/07 14:39:48 *** NewslineArchiveServceImpl.updateNewslineArchiveItem(String masterId, String displayName) ***
07/05/07 14:39:48 *** EditNewslineArchiveAction.findForward() - before super call
07/05/07 14:39:48 *** EditNewslineArchiveAction.findForward() - after super call
07/05/07 14:39:48 EditApplicantAction.prepareModel() - No events
07/05/07 14:39:49 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA897800000016000001126844BC10
07/05/07 14:39:49 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000303A4877800000017000001126844BC10
07/05/07 14:39:49 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA6F7800000018000001126844BC10
07/05/07 14:39:49 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA717800000019000001126844BC10
07/05/07 14:39:49 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA73780000001A000001126844BC10
07/05/07 14:39:49 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA75780000001B000001126844BC10
07/05/07 14:39:49 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA77780000001C000001126844BC10
07/05/07 14:39:49 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA79780000001D000001126844BC10
07/05/07 14:39:49 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA7D780000001E000001126844BC10
07/05/07 14:39:49 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA83780000001F000001126844BC10
07/05/07 14:39:49 getQueryHitCount returns the value: 12
Any help or direction to find an answer would be greatly appreciated!
Thanks, Ken
More information -
==> Select Edit on Row in table - Primarykey=238727
07/05/08 10:15:51 *** ShowNewslineArchiveAction.findForward() ***
May 8, 2007 10:15:51 AM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
May 8, 2007 10:15:51 AM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
07/05/08 10:15:51 getQueryHitCount returns the value: 12
07/05/08 10:15:54 ShowNewslineArchiveAction.prepareModel() - has events
07/05/08 10:15:54 *** ShowNewslineArchiveAction.findForward() ***
07/05/08 10:15:54 ShowNewslineArchiveAction.findForward()- event : setCurrentRowWithKey
07/05/08 10:15:54 ShowNewslineArchiveAction.findForward()- event : Edit
Forward "Edit" points to this page
07/05/08 10:15:54 *** EditNewslineArchiveAction.prepareModel() - before super call
07/05/08 10:15:54 *** EditNewslineArchiveAction.prepareModel() - after super call
07/05/08 10:15:54 *** EditNewslineArchiveAction.findForward() ***
07/05/08 10:15:54 Key.getAttribute(0) = 238727
07/05/08 10:15:54 *** EditNewslineArchiveAction.findForward() - before super call
07/05/08 10:15:54 *** EditNewslineArchiveAction.findForward() - after super call
May 8, 2007 10:15:54 AM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
==> Set value in displayname field to another value, press submit button - no processing in onSubmit()
07/05/08 10:15:59 *** EditNewslineArchiveAction.prepareModel() - before super call
07/05/08 10:15:59 *** EditNewslineArchiveAction.prepareModel() - after super call
07/05/08 10:16:00 Key.getAttribute(0) = 191113
oracle.jbo.RowNotFoundException: JBO-25020: View row of key oracle.jbo.Key[238727 ] not found in SearchRefCursor1.
at oracle.jbo.server.remote.RuntimeViewRowSetIteratorInfo.getRowFromKey(RuntimeViewRowSetIteratorInfo.java:505)
07/05/08 10:16:00 *** EditNewslineArchiveAction.findForward() ***
07/05/08 10:16:00 EditNewslineArchiveAction.findForward()- event : Submit
07/05/08 10:16:00 *** EditNewslineArchiveAction.findForward() - before super call
07/05/08 10:16:00 *** EditNewslineArchiveAction.findForward() - after super call
At this point See error message with RowNotFoundException. Don't understand where key was changed from 238727 to 191113 (first record in recordset.)
==> Press submit again - works how it should have from start
07/05/08 10:16:01 *** EditNewslineArchiveAction.prepareModel() - before super call
07/05/08 10:16:01 *** EditNewslineArchiveAction.prepareModel() - after super call
07/05/08 10:16:01 *** EditApplicantAction.onSubmmit() ***
07/05/08 10:16:01 Key.getAttribute(0) = 238727
07/05/08 10:16:01 *** EditNewslineArchiveAction.findForward() ***
07/05/08 10:16:01 EditNewslineArchiveAction.findForward()- event : Submit
07/05/08 10:16:01 *** EditNewslineArchiveAction.findForward() - before super call
07/05/08 10:16:01 *** EditNewslineArchiveAction.findForward() - after super call
I looked at section" 7.9 Summary of Difference Between Entity-Based View Objects and Read-Only View Objects" in Oracle Applicatin Development Framework Developer's Guide for Forms/4GL Developers. Since I am using a ViewObject based on a REF CURSOR, I added the setManageRowsByKey(true); in the create() method of my ViewObject. This didn't help.
Any suggestions?
Thanks, Ken
Similar Messages
-
A11-ST3500 :: missing Win login dialog, jumping cursor, delayed file saves
Greetings. Lifelong HP user. Decided to try Toshiba for employee and myself.
Went online and configured Tecra A-11SP3500. Have had nothing but problems. Mainly after it goes to sleep mode, when I try to wake it, I get the background screen with no log in. Must take the battery out in order to reboot.
As has happened twice as I have been typing this so far, the cursor jumps all over the screen.
Both issues are common with both laptops purchased.
Then there is the lag when I attempt to save anything. "Save As" screen pops up, "Not Responding" pops to the top of the screen and 10-15 seconds later it will save.
I am running very little on the machine. Office 2010 and little else.
I have contacted support thrice. Had trouble locating model # as all that is on or in the unit is A-11 but all listings have a suffix afterward. Finally got support on third call, to help locate the support page and a model number via the s/n.
Reloaded OS once after initial install. Upgraded bios and drivers. All to no avail. Support seems to know or care very little about the product or problem.
Any suggestions are welcomed. I am a very disappointed customer and wish I had stuck with HP.Hi Ross,
Have you tried calling back support (800-457-7777) after reloading the OS and updating the BIOS and drivers? If not, I recommend giving that a shot, along with looking for assistance from this user community.
If the Toshiba tech you speak with can't resolve the issue then they should either escalate your call to a higher-skilled agent or refer you to a repair center, if they determine that there is a hardware failure. Send me a Private Message with your name, phone number, and laptop's serial number if your call does not result in a suitable resolution.
I understand your disappointment but am renaming the Subject of this thread to something that describes the problems you're reporting, since that is much more likely to lead to finding help here in the forums.
Jim -
How can I iterate over the columns of a REF CURSOR?
I have the following situation:
DECLARE
text VARCHAR2 (100) := '';
TYPE gen_cursor is ref cursor;
c_gen gen_cursor;
CURSOR c_tmp
IS
SELECT *
FROM CROSS_TBL
ORDER BY sn;
BEGIN
FOR tmp IN c_tmp
LOOP
text := 'select * from ' || tmp.table_name || ' where seqnum = ' || tmp.sn;
OPEN c_gen FOR text;
-- here I want to iterate over the columns of c_gen
-- c_gen will have different number of columns every time,
-- because we select from a different table
-- I have more than 500 tables, so I cannot define strong REF CURSOR types!
-- I need something like
l := c_gen.columns.length;
for c in c_gen.columns[1]..c_gen.columns[l]
LOOP
-- do something with the column value
END LOOP;
END LOOP;
END;As you can see from the comments in the code, I couln'd find any examples on the internet with weak REF CURSORS and selecting from many tables.
What I found was:
CREATE PACKAGE admin_data AS
TYPE gencurtyp IS REF CURSOR;
PROCEDURE open_cv (generic_cv IN OUT gencurtyp, choice INT);
END admin_data;
CREATE PACKAGE BODY admin_data AS
PROCEDURE open_cv (generic_cv IN OUT gencurtyp, choice INT) IS
BEGIN
IF choice = 1 THEN
OPEN generic_cv FOR SELECT * FROM employees;
ELSIF choice = 2 THEN
OPEN generic_cv FOR SELECT * FROM departments;
ELSIF choice = 3 THEN
OPEN generic_cv FOR SELECT * FROM jobs;
END IF;
END;
END admin_data;
/But they have only 3 tables here and I have like 500. What can I do here?
Thanks in advance for any help!The issue here is that you don't know your columns at design time (which is generally considered bad design practice anyway).
In 10g or before, you would have to use the DBMS_SQL package to be able to iterate over each of the columns that are parsed from the query... e.g.
CREATE OR REPLACE PROCEDURE run_query(p_sql IN VARCHAR2) IS
v_v_val VARCHAR2(4000);
v_n_val NUMBER;
v_d_val DATE;
v_ret NUMBER;
c NUMBER;
d NUMBER;
col_cnt INTEGER;
f BOOLEAN;
rec_tab DBMS_SQL.DESC_TAB;
col_num NUMBER;
v_rowcount NUMBER := 0;
BEGIN
-- create a cursor
c := DBMS_SQL.OPEN_CURSOR;
-- parse the SQL statement into the cursor
DBMS_SQL.PARSE(c, p_sql, DBMS_SQL.NATIVE);
-- execute the cursor
d := DBMS_SQL.EXECUTE(c);
-- Describe the columns returned by the SQL statement
DBMS_SQL.DESCRIBE_COLUMNS(c, col_cnt, rec_tab);
-- Bind local return variables to the various columns based on their types
FOR j in 1..col_cnt
LOOP
CASE rec_tab(j).col_type
WHEN 1 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000); -- Varchar2
WHEN 2 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_n_val); -- Number
WHEN 12 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_d_val); -- Date
ELSE
DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000); -- Any other type return as varchar2
END CASE;
END LOOP;
-- Display what columns are being returned...
DBMS_OUTPUT.PUT_LINE('-- Columns --');
FOR j in 1..col_cnt
LOOP
DBMS_OUTPUT.PUT_LINE(rec_tab(j).col_name||' - '||case rec_tab(j).col_type when 1 then 'VARCHAR2'
when 2 then 'NUMBER'
when 12 then 'DATE'
else 'Other' end);
END LOOP;
DBMS_OUTPUT.PUT_LINE('-------------');
-- This part outputs the DATA
LOOP
-- Fetch a row of data through the cursor
v_ret := DBMS_SQL.FETCH_ROWS(c);
-- Exit when no more rows
EXIT WHEN v_ret = 0;
v_rowcount := v_rowcount + 1;
DBMS_OUTPUT.PUT_LINE('Row: '||v_rowcount);
DBMS_OUTPUT.PUT_LINE('--------------');
-- Fetch the value of each column from the row
FOR j in 1..col_cnt
LOOP
-- Fetch each column into the correct data type based on the description of the column
CASE rec_tab(j).col_type
WHEN 1 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_v_val);
DBMS_OUTPUT.PUT_LINE(rec_tab(j).col_name||' : '||v_v_val);
WHEN 2 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_n_val);
DBMS_OUTPUT.PUT_LINE(rec_tab(j).col_name||' : '||v_n_val);
WHEN 12 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_d_val);
DBMS_OUTPUT.PUT_LINE(rec_tab(j).col_name||' : '||to_char(v_d_val,'DD/MM/YYYY HH24:MI:SS'));
ELSE
DBMS_SQL.COLUMN_VALUE(c,j,v_v_val);
DBMS_OUTPUT.PUT_LINE(rec_tab(j).col_name||' : '||v_v_val);
END CASE;
END LOOP;
DBMS_OUTPUT.PUT_LINE('--------------');
END LOOP;
-- Close the cursor now we have finished with it
DBMS_SQL.CLOSE_CURSOR(c);
END;
SQL> exec run_query('select empno, ename, deptno, sal from emp where deptno = 10');
-- Columns --
EMPNO - NUMBER
ENAME - VARCHAR2
DEPTNO - NUMBER
SAL - NUMBER
Row: 1
EMPNO : 7782
ENAME : CLARK
DEPTNO : 10
SAL : 2450
Row: 2
EMPNO : 7839
ENAME : KING
DEPTNO : 10
SAL : 5000
Row: 3
EMPNO : 7934
ENAME : MILLER
DEPTNO : 10
SAL : 1300
PL/SQL procedure successfully completed.
SQL> exec run_query('select * from emp where deptno = 10');
-- Columns --
EMPNO - NUMBER
ENAME - VARCHAR2
JOB - VARCHAR2
MGR - NUMBER
HIREDATE - DATE
SAL - NUMBER
COMM - NUMBER
DEPTNO - NUMBER
Row: 1
EMPNO : 7782
ENAME : CLARK
JOB : MANAGER
MGR : 7839
HIREDATE : 09/06/1981 00:00:00
SAL : 2450
COMM :
DEPTNO : 10
Row: 2
EMPNO : 7839
ENAME : KING
JOB : PRESIDENT
MGR :
HIREDATE : 17/11/1981 00:00:00
SAL : 5000
COMM :
DEPTNO : 10
Row: 3
EMPNO : 7934
ENAME : MILLER
JOB : CLERK
MGR : 7782
HIREDATE : 23/01/1982 00:00:00
SAL : 1300
COMM :
DEPTNO : 10
PL/SQL procedure successfully completed.
SQL> exec run_query('select * from dept where deptno = 10');
-- Columns --
DEPTNO - NUMBER
DNAME - VARCHAR2
LOC - VARCHAR2
Row: 1
DEPTNO : 10
DNAME : ACCOUNTING
LOC : NEW YORK
PL/SQL procedure successfully completed.
SQL>From 11g onwards, you can create your query as a REF_CURSOR, but then you would still have to use the DBMS_SQL package with it's new functions to turn the refcursor into a dbms_sql cursor so that you can then describe the columns in the same way.
http://technology.amis.nl/blog/2332/oracle-11g-describing-a-refcursor
Welcome to the issues that are common when you start to attempt to create dynamic code. If your design isn't specific then your code can't be either and you end up creating more work in the coding whilst reducing the work in the design. ;) -
How to fetch NO DATA FOUND exception in Ref Cursor.
In my procedure ref cursor is out parameter with returns dataset. in my proceudre
its like...
OPEN pPymtCur FOR
select.....
when I call this procedure from report to get dataset it causes NO DATA FOUND exception.
How to fetch this exception in my oracle procedure so I can get some other data.
Any Idea to do this?
Edited by: Meghna on 17-Jun-2009 22:28Mass25 wrote:
Correct me if I am wrong.
So if I do something as follows in my stored proc, I do not have to check for NO_DATA_FOUND?
OPEN my_CuRSR FOR
SELECT DISTINCT blah blah blahmy_cursr is what I am returning as OUT param in my SP.Correct. At the point you open the cursor, oracle has not attempted any 'fetch' against the data so it won't know if there is any data or no data. that only occurs when a fetch is attempted.
Take a read of this:
[PL/SQL 101 : Understanding Ref Cursors|http://forums.oracle.com/forums/thread.jspa?threadID=886365&tstart=0] -
Unable to use ref cursor as a input parameter at the time of inserting reco
Hi
i am unable to use ref cursor when inserting the data to oracle 11g from visual studio 2008. please help me as early as possible my code is bellows
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Web.Configuration;
using Oracle.DataAccess.Client;
using Oracle.DataAccess.Types;
public partial class App_frmTest : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)
protected void btnClick_Click(object sender, EventArgs e)
OracleCommand cmd=new OracleCommand();
Data objdata = new Data();
int i = 0;
string constr = "Data Source=Cwc;User Id=scott; Password=tiger;";// enlist=false; pooling=false;
OracleConnection con = new OracleConnection(constr);
/*Connection Open*/
con.Open();
cmd.Connection = con;
/*Connection Open End*/
/*Select Through Ref Cursor*/
cmd.CommandText = "scott.TEST_USER.getUSER";
cmd.CommandType = CommandType.StoredProcedure;
OracleParameter p_rc = cmd.Parameters.Add("p_rc", OracleDbType.RefCursor, DBNull.Value, ParameterDirection.Output);
OracleParameter p_rc1;
if (TextBox1.Text == "")
p_rc1 = cmd.Parameters.Add("p_rc", OracleDbType.Int16, DBNull.Value, ParameterDirection.Input);
else
p_rc1 = cmd.Parameters.Add("p_rc", OracleDbType.Int16, Convert.ToInt16(TextBox1.Text), ParameterDirection.Input);
// OracleParameter p_rc1 = cmd.Parameters.Add("p_rc", OracleDbType.Int16, 2, ParameterDirection.Input);
OracleDataReader reader = cmd.ExecuteReader();
DataSet ds = new DataSet();
DataTable dt1 = new DataTable();
dt1.Load(reader);
ds.Tables.Add(dt1);
GridView1.DataSource = ds;
GridView1.DataBind();
cmd.Parameters.Clear();
con.Close();
con.Dispose();
OracleCommand cmd1 = new OracleCommand();
OracleConnection con1 = new OracleConnection(constr);
con1.Open();
cmd1.Connection = con1;
cmd1.CommandText = "scott.TEST_USER.ADDUSER";
cmd1.CommandType = CommandType.StoredProcedure;
OracleParameter P_ADDUSER = cmd1.Parameters.Add("P_ADDUSER", OracleDbType.RefCursor, DBNull.Value, ParameterDirection.Input);
cmd1.ExecuteNonQuery(); // i am getting error when executing this line
Server Error in '/CWC' Application.
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Source Error:
Line 77: OracleParameter P_ADDUSER = cmd1.Parameters.Add("P_ADDUSER", OracleDbType.RefCursor, DBNull.Value, ParameterDirection.Input);
Line 78: //OracleParameter P_MSG = cmd.Parameters.Add("P_MSG", OracleDbType.Varchar2, DBNull.Value, ParameterDirection.Output);
Line 79: cmd1.ExecuteNonQuery();
Line 80:
Line 81: DataTable dt = new DataTable();
Source File: d:\CWC\App\frmTest.aspx.cs Line: 79
Stack Trace:
[AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.]
Oracle.DataAccess.Client.OpsSql.ExecuteNonQuery(IntPtr opsConCtx, IntPtr& opsErrCtx, IntPtr& opsSqlCtx, IntPtr& opsDacCtx, IntPtr opsSubscrCtx, Int32& isSubscrRegistered, Int32 bchgNTFNExcludeRowidInfo, Int32 bQueryBasedNTFNRegistration, Int64& query_id, OpoSqlValCtx*& pOpoSqlValCtx, String pCommandText, IntPtr& pUTF8CommandText, IntPtr[] pOpoPrmValCtx, String[] ppOpoPrmRefCtx, OpoMetValCtx*& pOpoMetValCtx, Int32 prmCnt, Int32 bFromPool) +0
Oracle.DataAccess.Client.OracleCommand.ExecuteNonQuery() +4731
App_frmTest.btnClick_Click(Object sender, EventArgs e) in d:\CWC\App\frmTest.aspx.cs:79
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565Hi;
Its better to ask it at visual studio forum site:http://social.msdn.microsoft.com/Forums/en-US/category/visualstudio
Regard
Helios -
Hi,
I am trying to create a new sub site. Everytime I try to create the site I get this error:
the file you are attempting to save or retrieved has been blocked from this web site by server administrator
This applies to almost all site templates except the "blank site" template. I am logged in as System Administrator.Issue resolved!
Don't know how but somehow, xml was added to the Blocked file types. Removing the entry did the trick. -
Hi,
I am new to Ref Cursor concepts and I am trying a small block but its throwing error. Pls help me.
PACKAGE SPEC:
CREATE OR REPLACE PACKAGE PKG_JOBINFO AS
PROCEDURE JOBINFO ( v_job_id IN number, p_cursor OUT PKG_JOBINFO.RESULT_REF_CURSOR);
TYPE RESULT_REF_CURSOR IS REF CURSOR;
END PKG_JOBINFO;
PACKAGE BODY:
CREATE OR REPLACE package body PKG_JOBINFO
AS
PROCEDURE JOBINFO ( v_job_id IN number,
p_cursor OUT PKG_JOBINFO.RESULT_REF_CURSOR)
AS
BEGIN
OPEN p_cursor FOR
SELECT JOB_ID,
JOB_NAME,
TABLE_NAME
FROM JOB_INFO
WHERE JOB_ID=V_JOB_ID;
EXCEPTION
WHEN OTHERS THEN
raise;
END;
END;
While compiling the package i am not getting any errors. I am getting errors only while executing
SQL> exec PKG_JOBINFO.JOBINFO ('23');
BEGIN PKG_JOBINFO.JOBINFO ('23'); END;
ERROR at line 1:
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'JOBINFO'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
Please help me to resolve this error.
Thanks.user497267 wrote:
Thanks its working. So if we are using ref cursor we have to execute like this only.To add...
The actual issue you were experiencing was not because you were using ref cursors specifically, but because you had an OUT parameter in your procedure.
When you have an OUT parameter, you need to ensure that you pass in a variable to that parameter of the procedure in order that the procedure can populate it. In your case you were only passing in the first parameter, but you weren't passing in a variable to capture the OUTput.
What Alex showed was that by declaring a variable of the same datatype (ref cursor in your case) and passing that in as the second parameter, that variable was populated with the ref cursor information from inside the procedure. Once that variable was populated, after the procedure call, the data from that ref cursor can be obtained (using SQL*Plus' print command in Alex's example). -
Ref Cursors / throwing data into a Ref Cursor as data is fetched
I was wondering if anyone has executed an SQL statement and as each row is being fetched back from an SQL, doing some data checks and processing to see if the row is valid to return or not, based on the values being fetched in an SQL.
For example, I'm taking an SQL statement and trying to do some tuning. I have an Exists clause in the Where statement that has a nested sub-query with some parameters passed in. I am attempting to move that statement to a function call in a package (which is called in the SELECT statement). As I fetch each row back, I want to check some values that are Selected and if the values are met, then, I want to execute the function to see if the data exists. If it does exist, then, I want the fetched row returned in the Ref Cursor. If the criteria is met and the row doesn't exist in the function call, then, I don't want the fetched row to return.
Right now, the data has to be thrown to REF Cursor because it's being outputted to the Java application as a Result Set.
I've found many statements where you can take a SELECT statement and throw the Results in the Ref Cursor. But, I want to go a step further and before I throw each row in the Ref Cursor, I want to some processing to see if I put the Fetched Row in the Ref Cursor.
If someone has a better idea to accomplish this, I'm all ears. Like I say, I'm doing this method only for the sake of doing some database tuning and I think this will speed things up. Having the EXISTS clause works and it runs fast from an End-user standpoint but, when it processes on the database with the nested subquery, it is slow.
Here's an example of something that might be a problem (Notice the nested subquery). I moved the nested subquery to a function call written on the database package and make the call to the procedure/package in the SELECT statement. As I process each row, I want to check some values prior having the function call execute. If it meet some criteria, then the record is Ok to fetch and display in the Ref Cursor. If it does not meet the criteria and goes through the function and doesn't return data, then, I don't want the Fetched row from the main query to return the data.:
SELECT EMPNO,
FIRST_NAME,
LAST_NAME
FROM EMP E,
DEPT D
WHERE E.DEPTNO = D.DEPTNO
AND EXISTS (SELECT 'X'
FROM MANAGER M
WHERE M.MANAGER_ID = E.MANAGER_ID
AND MANAGER_TYPE IN (SELECT MANAGER_TYPE
FROM MANAGER_LOOKUP ML WHERE ML.MANAGER_TYPE = M.MANAGER_TYPE))
Any help or ideas of other things to try is appreciated. Keep in mind that I am returning this data to the Java application so, throwing the data to a Ref Cursor in the PL/SQL is the ideal method.
ChrisRef cursors are not required nor desirable when writing java database application. Cursors are mentioned only once in the JDBC documentation reference guide, in the section "Memory Leaks and Running Out of Cursors".
In a word cursors are just plain ridiculous, and in fact I never used them in my 15+ years of application development practice:
http://vadimtropashko.wordpress.com/cursors/ -
Help on CAST function, defining TYPE TABLE and using a REF cursor
Hi,
I have written a procedure (lookup) inside a package (lookup_pkg) as shown below.
Procedure has an output variable of type PL/SQL TABLE which is defined in the package.
I want to write a wrapper procedure lookupref to the procedure lookup to return a ref cursor.
CREATE OR REPLACE PACKAGE lookup_pkg AS
TYPE t_lookup_refcur IS REF CURSOR;
CURSOR c_lookup IS
Select columns1,2,3,....100
FROM A, B, C, D, E
WHERE ROWNUM < 1;
TYPE t_lookup IS TABLE OF c_lookup%ROWTYPE;
Procedure lookup(id Number, o_lookup OUT t_lookup);
End lookup_pkg;
CREATE OR REPLACE PACKAGE BODY lookup_pkg As
Procedure lookup(id Number, o_lookup OUT t_lookup) IS
BEGIN
END lookup;
Procedure lookupref(id Number, o_lookupref OUT t_lookup_refcur) IS
o_lookup t_lookup;
BEGIN
lookup(id, o_lookup t_lookup);
OPEN t_lookup_refcur FOR
SELECT *
FROM TABLE(CAST(o_lookup AS t_lookup));
Exception
End lookupref;
END lookup_pkg;
When I compile this procedure, I am getting invalid datatype Oracle error and
cursor points the datatype t_lookup in the CAST function.
1. Can anyone tell me what is wrong in this. Can I convert a PL/SQL collection (pl/sql table in this case) to PL/SQL datatype table or does it need to be a SQL datatype only (which is created as a type in database).
Also, to resolve this error, I have created a SQL type and table type instead of PL/SQL table in the package as shown below.
create or replace type t_lookuprec as object
(Select columns1,2,3,....100
FROM A, B, C, D, E
WHERE ROWNUM < 1);
create or replace type t_lookup_tab AS table of t_lookuprec;
CREATE OR REPLACE PACKAGE BODY lookup_pkg As
Procedure lookup(id Number, o_lookup OUT t_lookup) IS
BEGIN
END lookup;
Procedure lookupref(id Number, o_lookupref OUT t_lookup_refcur) IS
o_lookup t_lookup;
BEGIN
lookup(id, o_lookup t_lookup);
OPEN t_lookup_refcur FOR
SELECT *
FROM TABLE(CAST(o_lookup AS t_lookup_tab));
Exception
End lookupref;
END lookup_pkg;
When I compile this package, I am getting "PL/SQL: ORA-22800: invalid user-defined type" Oracle error and
points the datatype t_lookup_tab in the CAST function.
2. Can anyone tell me what is wrong. Can I create a type with a select statement and create a table type using type created earlier?
I have checked the all_types view and found that
value for Incomplete column for these two types are YES.
3. What does that mean?
Any suggestions and help is appreciated.
Thanks
Srinivascreate or replace type t_lookuprec as object
(Select columns1,2,3,....100
FROM A, B, C, D, E
WHERE ROWNUM < 1);You are correct that you need to use CREATE TYPE to use the type in SQL.
However unless I am mistaken you appear to have invented your own syntax for CREATE TYPE, suggest you refer to Oracle documentation. -
Ref cursors in Database adapter
Hi,
Is the database adapter capable of handling ref cursors as the datatype of the output parameters of a pl/sql procedure?
For instance if I have the following in my package-spec:
TYPE SomeRecordType IS RECORD
( record_pk mut_table.record_pk%TYPE
, person_nr person_table.person_nr%TYPE
, field_1 mut_table.field_1%type
, field_2 mut_table.field_2%type
, field_3 mut_table.field_3%type
TYPE SomeCursorType IS REF CURSOR RETURN SomeRecordType;
PROCEDURE read_records
( cursor_out OUT SomeCursorType
, exception_code OUT number
, exception_message OUT varchar2
Can the database adapter call the read_records procedure?
I've never seen this in any doc. I know it can't handle record types (that is in 10.1.2 it couldn't as far as I know). So I figure that the above is not possible.
Thanks in advance.
Regards,
MartienWe have successfully used a sys_refcursor OUT parameter for a database procedure call and which is used by a DBAdapter to return a single dataset.
At the time I remember attempting to use a strongly typed ref cursor as the parameter. I think this is what you are attempting to do. I rejected this approach at the time as I was not able to do this. It was, in our case, as simple as using the system defined ref cursor type (i.e. weakly typed).
The handling of the returned dataset was not immediately obvious, but can be handled by as fairly simple XSL transformation to a locally defined variable of the requisite xml structure. I won't describe in detail how to do it as it is specific to our process. Suffice to say the transformation loops over all result rows assign via a test to the correct result field in our local variable.
e.g.
<xsl:template match="/">
<ns1:BatchRequest004>
<xsl:for-each select="/db:OutputParameters/db:P_SCHSHP_REF_CUR/db:Row">
<ns1:statusRqst>
<xsl:if test='db:Column/@name = "ID"'>
<xsl:attribute name="id">
<xsl:value-of select="db:Column[1.0]"/>
</xsl:attribute>
</xsl:if>
</ns1:statusRqst>
</xsl:for-each>
</ns1:BatchRequest004>
HTH and that I haven't misidentified your problem. -
Help! Muse 2014.3 keeps crashing when I attempt to save my .muse file
I have the latest version of Muse [2014.3] Since the update the application repeatedly crashes at the least 'provocation'.
I'm building a multipage website for a client and brought the last file home [I'd been working on it at my office]. One or two of the image files needed updating, which I did. When I attempted to save the updated file I got [and keep getting] a fatal error.
The error message reads: "Dangling Ref or Ownership: BoxPageItem refers to unknown UID, BoxPageItem refers to unknown UID, BoxPageItem refers to unknown UID".
The application then hangs and I have to force quit. This is happening repeatedly and the dialogue tells me nothing about how to fix these errors [3 image errors perhaps, since the current crashes happen after updating images?]. I'm in a serious time crunch now, how can I recover my file to continue working on this project and what is causing the problem? Anyone help me?
Is this version of Muse really that unstable?
Thanks,
CharlieHi Fabia,
I think I fixed it over the weekend. But interestingly, my problem was images inside compositions too.
I did something similar to you, where I didn't let Muse update when the file opens [which was causing the crashes]. Instead I located the images in the assets panel, opened them in Photoshop and resaved them. Then I imported and saved after each one. This seemed to work.
For me, the 'container' was apparently OK, I had the background fill set to none anyhow, so reasoned there might be a problem with one of the seven images [seven in my case, but which one, or maybe all?]. Since then, I've been able to add content and save normally, and this morning I've been able to let the client see the site progress, as promised.
Thanks for the reply and good luck with your project.
Charlie -
Display output of ref cursor in sql developer
Hi,
I am writing following procedure.
create or replace
procedure test_output(
arg_like in varchar2,
cv_results in out sys_refcursor)
is
Type sys_refcursor is ref cursor;
begin
open cv_results for
select * from claim_status where status_id like 'arg_like%';
end;
I would like to check the output by running the procedure in sql developer.Boneist wrote:
What, not even if you run it as a script?
This is in the [SQL Developer Documentation|http://download.oracle.com/docs/cd/E12151_01/doc.150/e12152/intro.htm#CHDJBBIH] :
1.7.1 SQL*Plus Statements Supported and Not Supported in SQL WorksheetThe SQL Worksheet supports some SQL*Plus statements. SQL*Plus statements must be interpreted by the SQL Worksheet before being passed to the database; any SQL*Plus that are not supported by the SQL Worksheet are ignored and not passed to the database.
The following SQL*Plus statements are not supported by the SQL Worksheet:
a[ppend]
archive
attr[ibute]
bre[ak]
bti[tle]
c[hange]
col[ulmn]
comp[ute]
copy
del
disc[onnect]
ed[it]
get
help
i[nput]
l[ist]
newpage
oradebug
passw[ord]
print
r[un]
recover
repf[ooter]
reph[eader]
sav[e]
sho[w]
shu[tdown]
spo[ol]
startup
store
tti[tle]
*var[iable]* -
Is there a different way to open a cursor for a ref cursor procedure?
hello everybody
i have two cursors, cur_a and cur_b, declared somewhere else in my application.
These two cursors have the same fields, in the same order, and i have to treat both in the same way. So i wrote a routine that gets as input a ref cursor based on the cur_a rowtype, and i am trying to use this routine for both.
The problem is that i am not able to open outside the routine the cursor in a different way than usual...
the common method is :
declare curs ref cursor ...
begin
open curs for (select *...)
end;
instead i would like to obtain something different
declare curs ref cursor ...
begin
open curs for cur_a
end;hi
thanks for answering
i wanted just to give a better idea, anyway you were near to get it.
the only difference is that the two cursors are not written in dynamic sql, just like strings, but are real cursors.
anyway, this is the version of the package i need, but i am not able to compile
(your original code is commented and immediately below there is my code)
CREATE OR REPLACE PACKAGE BODY mytest
IS
--cur_a VARCHAR2(200) := 'SELECT dummy FROM DUAL';
CURSOR cur_a
IS
SELECT dummy
FROM DUAL;
--cur_b VARCHAR2(200) := 'SELECT ''fred'' FROM DUAL';
CURSOR cur_b
IS
SELECT 'fred' fred
FROM DUAL;
TYPE t_cur_a IS REF CURSOR
RETURN cur_a%ROWTYPE
--PROCEDURE routine_a_b (p_cur SYS_REFCURSOR) IS
PROCEDURE routine_a_b (p_cur t_cur_a)
IS
v_x VARCHAR2 (10);
BEGIN
LOOP
FETCH p_cur
INTO v_x;
EXIT WHEN p_cur%NOTFOUND;
DBMS_OUTPUT.put_line (v_x);
END LOOP;
END;
PROCEDURE doit
IS
--v_curs SYS_REFCURSOR;
v_curs t_cur_a;
BEGIN
NULL;
-- open v_curs FOR cur_a;
OPEN v_curs FOR cur_a;
routine_a_b (v_curs);
CLOSE v_curs;
-- open v_curs FOR cur_b;
-- routine_a_b(v_curs);
-- close v_curs;
END;
END;
the error is:
cursor 'V_CURS' cannot be used in dynamic SQL OPEN statement
i did read that if use weak ref cursor, it could work, so i declare the ref cursor type in this way:
TYPE t_cur_a IS REF CURSOR;
instead than
TYPE t_cur_a IS REF CURSOR
RETURN cur_a%ROWTYPE
what i get is another error (in the open cursor command)
PLS-00382: expression is of wrong type....
but if i replace
OPEN v_curs FOR cur_a;
with
OPEN v_curs for select dummy from dual;
it works... but i already knew it.. :-)
anyway, i used a work around to resolve it, so it's just philosophy -
Using Ref Cursors as region source
Is it possible to use a function that returns a ref cursor as a region's source? I asked this question at the end of another thread and got no response so I made this new thread.
I created an application called 'ref cursor' on apex.oracle.com at
http://apex.oracle.com/pls/otn/f?p=4550
Workspace : wc_jason
username: dev
password: password
There is a table named TBL and a function returning a ref cursor name FNC. On the home page there are three regions, one using a sql statement, one using a pl/sql function returning a sql statement, and one that attempts to use a ref cursor. The ref cursor region's condition is set to NEVER because I couldn't get it to work and I wanted to show the page with the two working regions.
Can I even use a ref cursor in this manor?
Thanks for the help.Heres a quick example I did for you:
create or replace package pkg_refcursordemo
as
type rc_generic is ref cursor;
rec_emp emp%rowtype;
type tab_emp is table of emp%rowtype;
procedure proc_get_emp (
pi_ename in emp.ename%type
,pio_emp_rc in out rc_generic
function func_get_emp (
pi_ename in emp.ename%type
return tab_emp pipelined;
end pkg_refcursordemo;
create or replace package body pkg_refcursordemo
as
-- Procedure with in out ref cursor parameter
procedure proc_get_emp (
pi_ename in emp.ename%type
,pio_emp_rc in out rc_generic
is
begin
open pio_emp_rc for
select empno
, ename
, job
, mgr
, hiredate
, sal
, comm
, deptno
from emp
where ename like pi_ename||'%';
end proc_get_emp;
-- Wrapper pipelined function
function func_get_emp (
pi_ename in emp.ename%type
return tab_emp pipelined
is
l_rc_generic rc_generic;
l_rec_emp emp%rowtype;
begin
proc_get_emp (
pi_ename => pi_ename
,pio_emp_rc => l_rc_generic
loop
fetch l_rc_generic into l_rec_emp;
exit when l_rc_generic%notfound;
pipe row ( l_rec_emp );
end loop;
close l_rc_generic;
return;
end func_get_emp;
end pkg_refcursordemo;
create or replace view vw_emp
as
select empno
, ename
, job
, mgr
, hiredate
, sal
, comm
, deptno
from table ( pkg_refcursordemo.func_get_emp( null ) )
SQL> select * from vw_emp;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 17-DEC-80 800 20
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7566 JONES MANAGER 7839 02-APR-81 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7788 SCOTT ANALYST 7566 19-APR-87 3000 20
7839 KING PRESIDENT 17-NOV-81 5000 10
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7876 ADAMS CLERK 7788 23-MAY-87 1100 20
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7900 JAMES CLERK 7698 03-DEC-81 950 30
7902 FORD ANALYST 7566 03-DEC-81 3000 20
7934 MILLER CLERK 7782 23-JAN-82 1300 10
14 rows selected.
SQL>
Whats cool is you can declare the view with an APEX variable in it e.g.
create or replace view vw_emp
as
select empno
, ename
, job
, mgr
, hiredate
, sal
, comm
, deptno
from table ( pkg_refcursordemo.func_get_emp( v('P1_ENAME_PARAM' ) )
/ -
Hi,
is it possible to use a REF cursor as a parameter for a job? I need jobs created with DBMS_SCHEDULER.create_job to process data which has always the same format but comes from different sources. The job must be generic and thus should not know where the data comes from. The job calls a PL/SQL procdure which takes the REF cursor as a parameter.
Regards,
Pat
Edited by: Gwydion on Jun 16, 2010 7:13 AMGwydion wrote:
I tried a different way: Instead of a ref cursor, I tried to pass a PL/SQL table containing the data that the job should process. Bad idea in general as this is not very scalable. A PL/SQL "+table+" is nothing table-like at all. The correct term is array or collection. This structure is primitive in that it cannot be indexed or structured like a SQL table. It also resides in "expensive" memory (the PGA/private memory of a server process) - unlike a SQL table data that will reside in the SGA buffer cache when used. The db buffer cache is shared memory - usable by all processes and thus "inexpensive" memory in comparison.
So passing and processing any largish data structure that way (via PGA memory) is inherently an unscalable approach. Also, this data set needs to persist until the job process kicks off - thus it needs to be stored somewhere. Why store this data again when it is based on table and row table that already exist in the database? Why duplicate the data?
You also need to consider data concurrency and integrity. By the time that job/scheduler background process kicks off and receives this data set structure to use for processing... the row data that this set was based on may have changed.. or may not even exist anymore.
For example, let's say that the data set contains a list of invoice numbers that need to be processed. Some of those invoices may have been canceled in the meantime. Or deleted from the system. Whatever invoice numbers this background server process now needs to deal with, can now be invalid.
You therefore need to carefully consider exactly what issues and requirements you're trying to address with this approach you are attempting. There are numerous problems areas that it needs to deal with.
Which begs the question - why are you considering this approach? What problem are you trying to address? Why not simply pass the parameters to the job it needs to use to call the procedure that creates the ref cursor? This is a much simpler and elegant solution than to pass the actual data returned by the ref cursor to the job.
Maybe you are looking for
-
HT4623 my ipad will not start and i get a itunes message with a plug and music note symble
My ipad will not start up and i get a plug and music note symble displayed what can i do I already tried the soft boot
-
HI, My time data comes in using the system time from the computer and does not start at zero. It is often starting at 3000 sec or 6240 sec, etc.. When I run my report I am constantly having to change the beginning and end times in order to capture t
-
Having problems in ocfs2 while installing oracle 10g rac on linux as 4
this is the frist time i am try to install oracle rac based on three PCs after installing ocfs2 when i try to configure nodes through console i see the following msg "Could not start cluster stack .this must be resolved before any OCFS2 file system c
-
Saving a drawing as vector file?
I am new to Adobe Ideas--how can I save a drawing as a vector file? or a PDF that is editable in Illustrator CS6?
-
Lagging experience at all interface animations in OS X Mavericks
Hi, I am having the same problem described in the topic https://discussions.apple.com/thread/5479303?tstart=0 So I have completed the steps suggested to reset the SMC and later made a ETRE check. I have pasted the check report in here. Please suggest