When can lexical / bind variables be changed?

Hi Oracle Reports Team :--),
hope you are all doing fine.
I am using a very flexible mechanism to format my reports based on html-like format declarations (<bold>, <italic>, ...) in the text I retrieve from the database.
Therefore I use lexical parameters like
&normal1&bold1&italic1&normal2&italic2 ... in a boilerplate text.
This works fine.
Now for the tricky part: I can only manage to supply the values for the lexical parameters ONCE!
But I would like to change the values of the lexical parameters for the
[list]
[*] next iteration of a repeating frame or
[*] for the next retrieved row in the query
[list]
Thanx in advance for any help,
~Dietmar.
null

Hi Oracle Reports Team :--),
hope you are all doing fine.
I am using a very flexible mechanism to format my reports based on html-like format declarations (<bold>, <italic>, ...) in the text I retrieve from the database.
Therefore I use lexical parameters like
&normal1&bold1&italic1&normal2&italic2 ... in a boilerplate text.
This works fine.
Now for the tricky part: I can only manage to supply the values for the lexical parameters ONCE!
But I would like to change the values of the lexical parameters for the
[list]
[*] next iteration of a repeating frame or
[*] for the next retrieved row in the query
[list]
Thanx in advance for any help,
~Dietmar.
null

Similar Messages

  • Functionality loss when 'Using Query Bind Variables in Advanced Search

    Regarding: 'Using Query Bind Variables in Quick or Advanced Search'
    The functionality to do the following is lost when I use bind variables in the Advanced Search:
    "Result matches all conditions"
    "Result matches any condition"
    "Case Sensitive?"
    Is there a way to Search with Detail groups but to keep the above functionality?

    Hi,
    Your application module impl java class extends the JHeadstart class JhsApplicationModuleImpl. THe latter declares a method:
    public void advancedSearch(String viewObjectUsage,java.util.ArrayList arguments,Boolean allConditionsMet).
    In your application module impl java override the advancedSearch method where you can include your own custom code before invoking the super method:
    super.advancedSearch(viewObjectUsage,arguments,allConditionsMet);
    The 'arguments' parameter is an arraylist of QueryCondition objects. You can set several properties for QueryCondition objects such as case-sensitity, operators etc.
    Regards,
    Ibrahim

  • Query taking too long when using bind variable

    Hi All,
    There is a query in our prod DB which runs very slow (approx 2 hours) when it uses Bind Variables (using JDBC thin client), and when i try passing the variable using TOAD/SQL developer it runs fine.
    Explain Plan for running Query
    SELECT STATEMENT ALL_ROWSCost: 146 Bytes: 379 Cardinality: 1                                                   
         21 SORT ORDER BY Cost: 146 Bytes: 379 Cardinality: 1                                              
              20 NESTED LOOPS Cost: 145 Bytes: 379 Cardinality: 1                                         
                   17 HASH JOIN Cost: 22 Bytes: 42,558 Cardinality: 123                                    
                        15 MERGE JOIN CARTESIAN Cost: 15 Bytes: 8,910 Cardinality: 27                               
                             12 FILTER                          
                                  11 NESTED LOOPS OUTER Cost: 9 Bytes: 316 Cardinality: 1                     
                                       8 NESTED LOOPS OUTER Cost: 8 Bytes: 290 Cardinality: 1                
                                            5 NESTED LOOPS Cost: 6 Bytes: 256 Cardinality: 1           
                                                 2 TABLE ACCESS BY GLOBAL INDEX ROWID TABLE GDP.GDP_FX_DEALS_INCREMENTOR Cost: 4 Bytes: 28 Cardinality: 1 Partition #: 9 Partition access computed by row location     
                                                      1 INDEX RANGE SCAN INDEX GDP.GDP_FX_DEALS_INC_IDX_01 Cost: 3 Cardinality: 1
                                                 4 TABLE ACCESS BY INDEX ROWID TABLE GDP.GDP_FX_DEALS Cost: 2 Bytes: 228 Cardinality: 1      
                                                      3 INDEX UNIQUE SCAN INDEX (UNIQUE) GDP.GDP_FX_DEALS_KEY Cost: 1 Cardinality: 1
                                            7 TABLE ACCESS BY INDEX ROWID TABLE GDP.GDP_FX_DEALS Cost: 2 Bytes: 34 Cardinality: 1           
                                                 6 INDEX UNIQUE SCAN INDEX (UNIQUE) GDP.GDP_FX_DEALS_KEY Cost: 1 Cardinality: 1      
                                       10 TABLE ACCESS BY INDEX ROWID TABLE GDP.GDP_COUNTERPARTIES Cost: 1 Bytes: 26 Cardinality: 1                
                                            9 INDEX UNIQUE SCAN INDEX (UNIQUE) GDP.PK_CPTY Cost: 0 Cardinality: 1           
                             14 BUFFER SORT Cost: 14 Bytes: 448 Cardinality: 32                          
                                  13 TABLE ACCESS FULL TABLE GDP.GDP_CITIES Cost: 6 Bytes: 448 Cardinality: 32                     
                        16 TABLE ACCESS FULL TABLE GDP.GDP_AREAS Cost: 6 Bytes: 2,304 Cardinality: 144                               
                   19 TABLE ACCESS BY INDEX ROWID TABLE GDP.GDP_PORTFOLIOS Cost: 1 Bytes: 33 Cardinality: 1                                    
                        18 INDEX UNIQUE SCAN INDEX (UNIQUE) GDP.PORTFOLIOS_KEY Cost: 0 Cardinality: 1                               
    Explain Plan for Slow Query
    Plan
    SELECT STATEMENT ALL_ROWSCost: 11,526,226 Bytes: 119,281,912 Cardinality: 314,728                                                   
         21 SORT ORDER BY Cost: 11,526,226 Bytes: 119,281,912 Cardinality: 314,728                                              
              20 HASH JOIN Cost: 11,510,350 Bytes: 119,281,912 Cardinality: 314,728                                         
                   2 TABLE ACCESS BY INDEX ROWID TABLE GDP.GDP_PORTFOLIOS Cost: 1,741 Bytes: 177,540 Cardinality: 5,380                                    
                        1 INDEX FULL SCAN INDEX (UNIQUE) GDP.PORTFOLIOS_KEY Cost: 14 Cardinality: 5,380                               
                   19 HASH JOIN Cost: 11,507,479 Bytes: 87,932,495,360 Cardinality: 254,140,160                                    
                        3 TABLE ACCESS FULL TABLE GDP.GDP_AREAS Cost: 6 Bytes: 2,304 Cardinality: 144                               
                        18 MERGE JOIN CARTESIAN Cost: 11,506,343 Bytes: 18,602,733,930 Cardinality: 56,371,921                               
                             15 FILTER                          
                                  14 HASH JOIN RIGHT OUTER Cost: 3,930,405 Bytes: 556,672,868 Cardinality: 1,761,623                     
                                       5 TABLE ACCESS BY INDEX ROWID TABLE GDP.GDP_COUNTERPARTIES Cost: 6,763 Bytes: 892,580 Cardinality: 34,330                
                                            4 INDEX FULL SCAN INDEX (UNIQUE) GDP.PK_CPTY Cost: 63 Cardinality: 34,330           
                                       13 HASH JOIN OUTER Cost: 3,923,634 Bytes: 510,870,670 Cardinality: 1,761,623                
                                            10 HASH JOIN Cost: 2,096,894 Bytes: 450,975,488 Cardinality: 1,761,623           
                                                 7 TABLE ACCESS BY GLOBAL INDEX ROWID TABLE GDP.GDP_FX_DEALS_INCREMENTOR Cost: 2,763 Bytes: 52,083,248 Cardinality: 1,860,116 Partition #: 14 Partition access computed by row location     
                                                      6 INDEX RANGE SCAN INDEX GDP.GDP_FX_DEALS_INC_IDX_01 Cost: 480 Cardinality: 334,821
                                                 9 TABLE ACCESS BY INDEX ROWID TABLE GDP.GDP_FX_DEALS Cost: 1,734,205 Bytes: 8,320,076,820 Cardinality: 36,491,565      
                                                      8 INDEX FULL SCAN INDEX (UNIQUE) GDP.GDP_FX_DEALS_KEY Cost: 104,335 Cardinality: 39,200,838
                                            12 TABLE ACCESS BY INDEX ROWID TABLE GDP.GDP_FX_DEALS Cost: 1,733,836 Bytes: 1,331,145,696 Cardinality: 39,151,344           
                                                 11 INDEX FULL SCAN INDEX (UNIQUE) GDP.GDP_FX_DEALS_KEY Cost: 104,335 Cardinality: 39,200,838      
                             17 BUFFER SORT Cost: 11,499,580 Bytes: 448 Cardinality: 32                          
                                  16 TABLE ACCESS FULL TABLE GDP.GDP_CITIES Cost: 4 Bytes: 448 Cardinality: 32                     
    How can I avoid that.
    Thanks

    Hello
    Could you reformat your execution plans because they aren't particularly readable. The forums allow you to preserve the formatting of code or output by putting the symbol {noformat}{noformat} before and after the section of text you want to preserve formatting for. 
    If you write
    {noformat}select * from v$version
    {noformat}
    it will be displayed asselect * from v$version
    So can you run this above statement and post the output here so we know the full oracle version you are working with?  And finally, it would be really helpful to see the query you are running.  When you say it runs fine in Toad, is that when you replace the bind variables with the values or are you also using bind variables in Toad?
    Cheers
    David                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How can i create "bind variable"

    How can i create "bind variable" in my DB to support any procedure in my DB.
    Thank you very much.

    In SQL*PLUS we can defined bind variable
    SQL>var x varchar2(250); -- Is x bind variable or i'm misunderstand ?
    and ... in my procedure i can used ' &x ' to pass valued of 'x' from sql prompt to my procedure.
    but i'm not sure variable x is still remain in DB because i need to pass variable
    " v_stmt := 'and employee_id between ..... ' " from FORM to PROCEDURE in DB
    how can i do

  • Problems with Date bind variable

    I'm trying to use a Date as a bind variable in a View Object, and I'm running into difficulties. I've got the bind variable type set to date, and the control hints for Format Type and Format set to "Simple Date" and "yyyy-MM-dd" respectively. When I run the application module test and enter the date in the correct format, the View Object returns the expected results. However, when I try to set a Query Bind Parameters property for a JHeadstart group in my application definition in order to set the bind variable's value from an dateField input control, I get the following exception:
    30-Jan 08:49:56 ERROR (ErrorReportingUtils) -java.lang.IllegalArgumentException
    at java.sql.Date.valueOf(Date.java:104)
    at oracle.jbo.domain.Date.toDate(Date.java:348)
    at oracle.jbo.domain.Date.<init>(Date.java:279)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
    at oracle.jbo.domain.TypeConvMapEntry.convert(TypeConvMapEntry.java:73)
    at oracle.jbo.domain.TypeFactory.get(TypeFactory.java:739)
    at oracle.jbo.domain.TypeFactory.getInstance(TypeFactory.java:90)
    at oracle.jbo.common.VariableImpl.convertToJava(VariableImpl.java:546)
    at oracle.jbo.common.VariableValueManagerImpl.doSetVariableValue(VariableValueManagerImpl.java:182)
    at oracle.jbo.common.VariableValueManagerImpl.setVariableValue(VariableValueManagerImpl.java:223)
    at oracle.jbo.common.VariableValueManagerImpl.setVariableValue(VariableValueManagerImpl.java:229)
    at oracle.jheadstart.model.adfbc.v2.JhsApplicationModuleImpl.applyBindParams(JhsApplicationModuleImpl.java:173)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at oracle.adf.model.binding.DCInvokeMethod.invokeMethod(DCInvokeMethod.java:507)
    at oracle.adf.model.binding.DCDataControl.invokeMethod(DCDataControl.java:1795)
    at oracle.adf.model.bc4j.DCJboDataControl.invokeMethod(DCJboDataControl.java:1989)
    at oracle.adf.model.binding.DCInvokeMethod.callMethod(DCInvokeMethod.java:219)
    at oracle.jbo.uicli.binding.JUCtrlActionBinding.doIt(JUCtrlActionBinding.java:1289)
    at oracle.adf.model.binding.DCDataControl.invokeOperation(DCDataControl.java:1802)
    at oracle.jbo.uicli.binding.JUCtrlActionBinding.invoke(JUCtrlActionBinding.java:627)
    at oracle.adf.model.binding.DCInvokeActionDef$DCInvokeAction.refresh(DCInvokeActionDef.java:140)
    at oracle.adf.model.binding.DCBindingContainer.internalRefreshControl(DCBindingContainer.java:2521)
    at oracle.adf.model.binding.DCBindingContainer.refresh(DCBindingContainer.java:2260)
    at oracle.adf.controller.v2.lifecycle.PageLifecycleImpl.prepareRender(PageLifecycleImpl.java:534)
    at oracle.adf.controller.faces.lifecycle.FacesPageLifecycle.prepareRender(FacesPageLifecycle.java:98)
    at oracle.jheadstart.controller.jsf.lifecycle.JhsPageLifecycle.prepareRender(JhsPageLifecycle.java:1155)
    at oracle.adf.controller.v2.lifecycle.Lifecycle$1.execute(Lifecycle.java:297)
    at oracle.adf.controller.v2.lifecycle.Lifecycle.executePhase(Lifecycle.java:116)
    at oracle.adf.controller.faces.lifecycle.ADFPhaseListener.mav$executePhase(ADFPhaseListener.java:29)
    at oracle.adf.controller.faces.lifecycle.ADFPhaseListener$1.before(ADFPhaseListener.java:426)
    at oracle.adf.controller.faces.lifecycle.ADFPhaseListener.beforePhase(ADFPhaseListener.java:77)
    at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:228)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:137)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:214)
    at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
    at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:162)
    at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)
    at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._invokeDoFilter(AdfFacesFilterImpl.java:228)
    at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._doFilterImpl(AdfFacesFilterImpl.java:197)
    at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl.doFilter(AdfFacesFilterImpl.java:123)
    at oracle.adf.view.faces.webapp.AdfFacesFilter.doFilter(AdfFacesFilter.java:103)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:621)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
    at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
    at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
    at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
    at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
    at java.lang.Thread.run(Thread.java:595)
    However, it seems that the value of the bind parameter did in fact change, according to the debug message issued by the JhsApplicationModuleImpl.applyBindParams(...) procedure:
    30-Jan 08:46:23 DEBUG (JhsApplicationModuleImpl) -ViewObject ViewObj: value of bind param move_date has changed: old value=null ,new value=Wed Jan 07 00:00:00 CST 2009
    One thing I have noticed that may be of interest - if I run the debugger into the JhsApplicationModuleImpl.applyBindParams(...) procedure, a default date in my bind variable shows up as an oracle.jbo.domain.Date object when it comes out of the following line:
    Object oldValue = vo.ensureVariableManager().getVariableValue(key);
    as opposed to the new value that gets sent from the input value of the dateField control, which shows up as a java.util.Date in the following line:
    Object value = args.get(key);
    In the string of functions leading up to the following in the stack trace:
                   at java.sql.Date.valueOf(Date.java:104)
    at oracle.jbo.domain.Date.toDate(Date.java:348)
    at oracle.jbo.domain.Date.<init>(Date.java:279)
    it looks like the value of the java.util.Date is converted to a string, then passed to these functions to be turned into a java.sql.Date object. However, according to the java.sql.Date.valueOf(...) function, it's expecting date in "yyyy-mm-dd" format, per the header comments:
    * Converts a string in JDBC date escape format to
    * a <code>Date</code> value.
    * @param s a <code>String</code> object representing a date in
    * in the format "yyyy-mm-dd"
    * @return a <code>java.sql.Date</code> object representing the
    * given date
    * @throws IllegalArgumentException if the date given is not in the
    * JDBC date escape format (yyyy-mm-dd)
    When the input value from the dateField input control is added as a java.util.Date, the toString() is producing the wrong date format, which could be seen in the debug output I included above that said the bind variable has changed.
    Has anyone done this before that can let me know what I am missing and how to fix this? I've search all over the web, and all the articles I've seen relating to bind variables only refer to those of numeric or string types, which aren't giving me any trouble. Even the Developer's Guide (http://database.in2p3.fr/doc/oracle/Oracle_Application_Server_10_Release_3/web.1013/b25947/bcquerying009.htm) article "5.9 Using Named Bind Variables" doesn't reference using a Date type.

    I had the same problem about a year ago (using JHeadstart 10.1.3.2.52):
    15-feb 14:10:31 DEBUG (JhsApplicationModuleImpl) -Search item matches query bind param SubjectenKernPeildatum, value set to 2000-01-01
    15-feb 14:10:33 DEBUG (JhsApplicationModuleImpl) -Executing applyBindParams for BasServiceKern.AdresRollenSubjecten
    15-feb 14:10:33 DEBUG (JhsApplicationModuleImpl) -ViewObject AdresRollenSubjecten: value of bind param peildatum has changed: old value=null ,new value=Sat Jan 01 00:00:00 CET 2000
    15-feb 14:10:33 ERROR (ErrorReportingUtils) -java.lang.IllegalArgumentException
    at java.sql.Date.valueOf(Date.java:104)
    at oracle.jbo.domain.Date.toDate(Date.java:348)
    It appears a java.util.Date gets put on the criteria Map in the searchBean, this can't be used as input for a jbo.Date bindvariable.
    My ugly solution was to override public void applyBindParams(String voUsage,HashMap args)
    in MyProjectApplicationModuleImp (which extends JhsApplicationModuleImpl of course),
    check if value is a java.util.Date, and then
    value = new java.sql.Date(((java.util.Date)value).getTime());
    Greetings, HJ
    Edited by: HJHorst on Feb 6, 2009 12:22 AM

  • Bind variables in views

    I am having some performance issues using bind variables in views (Oracle 7.3.4). When I execute the view using '' values the view executes the expected execution plan. When I execute the view using bind variables the execution plan changes to something undesireable. I believe this to be a static execution plan in the case of using bind variables. I have updated all tables referenced by the view and compiled the view; but, the execution plan when using the bind variables does not change. Can you give me some advice on finding out why the execution plan in the case of using bind variables does not change based on the new set of statistics and being re-compiled.

    even if you use a literal isn't that automatically
    changed into a bind variable during at compile time?That would be the case when your have CURSOR_SHARING = FORCE. The default should be EXACT.
    SQL> show parameter cursor_sharing
    NAME                                 TYPE        VALUE
    cursor_sharing                       string      EXACT
    SQL>Actually, since you have the constants in the view, and if everyone uses the view, they share the same shared cursor (since the constants are never changing across each use).
    If you supplement the view with additional WHERE conditions (when using the view):
    SELECT <columns> FROM your_view WHERE <additional_conditions> ;
    Ten you might want to look into using bind variables for values used in such additional conditions.

  • Testing VOs that have positional bind variables with BC4J Tester

    Hi
    I am doing some OAF development for eBusiness 12.1.3 and would like to understand whether VOs that have positional bind variables can be tested using the BC4J Tester in JDeveloper 10.1.3 (the latest version of JDev compatible with OAF development). It looks like it should work as when you choose "Oracle Positional" in the VO wizard Binding Style it adds another text box to the to the Bind Variables page called Bind Positions, I assume that this is so you can create variables that you can populate in the Tester that will relate name to position but I get an error regarding column index when I use the BC4J Tester:
    oracle.jbo.SQLStmtException: JBO-27122: SQL error during statement preparation. Statement: SELECT CASE
    WHEN ph.closed_code IN ('CANCELLED', 'CLOSED','FINALLY CLOSED')
    THEN 'Expired Item'
    WHEN prl.unit_price <> pl.unit_price
    THEN 'Price Update'
    ELSE ''
    END item_status
    FROM po_lines pl,
    po_headers ph,
    po_requisition_lines prl
    WHERE ph.po_header_id = pl.po_header_id
    AND prl.blanket_po_header_id = pl.po_header_id
    AND prl.blanket_po_line_num = pl.line_num
    AND pl.po_header_id = :1
    AND pl.line_num = :2
    AND prl.requisition_line_id = :3
         at oracle.jbo.server.QueryCollection.buildResultSet(QueryCollection.java:833)
         at oracle.jbo.server.QueryCollection.executeQuery(QueryCollection.java:666)
         at oracle.jbo.server.ViewObjectImpl.executeQueryForCollection(ViewObjectImpl.java:3655)
         at oracle.jbo.server.OAJboViewObjectImpl.executeQueryForCollection(Unknown Source)
         at oracle.apps.fnd.framework.server.OAViewObjectImpl.executeQueryForCollection(OAViewObjectImpl.java:4560)
         at oracle.jbo.server.ViewRowSetImpl.execute(ViewRowSetImpl.java:742)
         at oracle.jbo.server.ViewRowSetImpl.executeQueryForMasters(ViewRowSetImpl.java:891)
         at oracle.jbo.server.ViewRowSetImpl.executeQueryForMode(ViewRowSetImpl.java:805)
         at oracle.jbo.server.ViewRowSetImpl.executeQuery(ViewRowSetImpl.java:799)
         at oracle.jbo.server.ViewObjectImpl.executeQuery(ViewObjectImpl.java:3575)
         at oracle.apps.fnd.framework.server.OAViewObjectImpl.executeQuery(OAViewObjectImpl.java:439)
         at oracle.jbo.jbotester.VariableDialog.save(VariableDialog.java:144)
         at oracle.jbo.jbotester.GenericDialog.actionPerformed(GenericDialog.java:219)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
         at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:234)
         at java.awt.Component.processMouseEvent(Component.java:5488)
         at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
         at java.awt.Component.processEvent(Component.java:5253)
         at java.awt.Container.processEvent(Container.java:1966)
         at java.awt.Component.dispatchEventImpl(Component.java:3955)
         at java.awt.Container.dispatchEventImpl(Container.java:2024)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
         at java.awt.Container.dispatchEventImpl(Container.java:2010)
         at java.awt.Window.dispatchEventImpl(Window.java:1774)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:153)
         at java.awt.Dialog$1.run(Dialog.java:515)
         at java.awt.Dialog.show(Dialog.java:536)
         at oracle.jbo.jbotester.JTDialog.show(JTDialog.java:121)
         at oracle.jbo.jbotester.JboTesterUtil.editBindParameters(JboTesterUtil.java:169)
         at oracle.jbo.jbotester.SimpleForm.setIterator(SimpleForm.java:65)
         at oracle.jbo.jbotester.SimpleForm.<init>(SimpleForm.java:51)
         at oracle.jbo.jbotester.VOTreeNode.showForm(VOTreeNode.java:115)
         at oracle.jbo.jbotester.BaseTree.processTreeMouseClicked(BaseTree.java:471)
         at oracle.jbo.jbotester.BaseTree.mav$processTreeMouseClicked(BaseTree.java:45)
         at oracle.jbo.jbotester.BaseTree$TreeMouseListener.mouseClicked(BaseTree.java:125)
         at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:212)
         at java.awt.Component.processMouseEvent(Component.java:5491)
         at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
         at java.awt.Component.processEvent(Component.java:5253)
         at java.awt.Container.processEvent(Container.java:1966)
         at java.awt.Component.dispatchEventImpl(Component.java:3955)
         at java.awt.Container.dispatchEventImpl(Container.java:2024)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3901)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
         at java.awt.Container.dispatchEventImpl(Container.java:2010)
         at java.awt.Window.dispatchEventImpl(Window.java:1774)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
    ## Detail 0 ##
    java.sql.SQLException: Invalid column index
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:138)
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:175)
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:240)
         at oracle.jdbc.driver.OraclePreparedStatement.setNUMBERInternal(OraclePreparedStatement.java:5891)
         at oracle.jdbc.driver.OraclePreparedStatement.setObjectCritical(OraclePreparedStatement.java:7674)
         at oracle.jdbc.driver.OraclePreparedStatement.setCustomDatumInternal(OraclePreparedStatement.java:7410)
         at oracle.jdbc.driver.OraclePreparedStatement.setObjectInternal(OraclePreparedStatement.java:8178)
         at oracle.jdbc.driver.OraclePreparedStatement.setObject(OraclePreparedStatement.java:8166)
         at oracle.jbo.server.BaseSQLBuilderImpl.bindParamValue(BaseSQLBuilderImpl.java:1847)
         at oracle.jbo.server.OracleSQLBuilderImpl.bindParamValue(OracleSQLBuilderImpl.java:3890)
         at oracle.jbo.server.BaseSQLBuilderImpl.bindParametersForStmt(BaseSQLBuilderImpl.java:3335)
         at oracle.jbo.server.ViewObjectImpl.bindParametersForCollection(ViewObjectImpl.java:13759)
         at oracle.jbo.server.QueryCollection.buildResultSet(QueryCollection.java:801)
         at oracle.jbo.server.QueryCollection.executeQuery(QueryCollection.java:666)
         at oracle.jbo.server.ViewObjectImpl.executeQueryForCollection(ViewObjectImpl.java:3655)
         at oracle.jbo.server.OAJboViewObjectImpl.executeQueryForCollection(Unknown Source)
         at oracle.apps.fnd.framework.server.OAViewObjectImpl.executeQueryForCollection(OAViewObjectImpl.java:4560)
         at oracle.jbo.server.ViewRowSetImpl.execute(ViewRowSetImpl.java:742)
         at oracle.jbo.server.ViewRowSetImpl.executeQueryForMasters(ViewRowSetImpl.java:891)
         at oracle.jbo.server.ViewRowSetImpl.executeQueryForMode(ViewRowSetImpl.java:805)
         at oracle.jbo.server.ViewRowSetImpl.executeQuery(ViewRowSetImpl.java:799)
         at oracle.jbo.server.ViewObjectImpl.executeQuery(ViewObjectImpl.java:3575)
         at oracle.apps.fnd.framework.server.OAViewObjectImpl.executeQuery(OAViewObjectImpl.java:439)
         at oracle.jbo.jbotester.VariableDialog.save(VariableDialog.java:144)
         at oracle.jbo.jbotester.GenericDialog.actionPerformed(GenericDialog.java:219)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
         at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:234)
         at java.awt.Component.processMouseEvent(Component.java:5488)
         at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
         at java.awt.Component.processEvent(Component.java:5253)
         at java.awt.Container.processEvent(Container.java:1966)
         at java.awt.Component.dispatchEventImpl(Component.java:3955)
         at java.awt.Container.dispatchEventImpl(Container.java:2024)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
         at java.awt.Container.dispatchEventImpl(Container.java:2010)
         at java.awt.Window.dispatchEventImpl(Window.java:1774)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:153)
         at java.awt.Dialog$1.run(Dialog.java:515)
         at java.awt.Dialog.show(Dialog.java:536)
         at oracle.jbo.jbotester.JTDialog.show(JTDialog.java:121)
         at oracle.jbo.jbotester.JboTesterUtil.editBindParameters(JboTesterUtil.java:169)
         at oracle.jbo.jbotester.SimpleForm.setIterator(SimpleForm.java:65)
         at oracle.jbo.jbotester.SimpleForm.<init>(SimpleForm.java:51)
         at oracle.jbo.jbotester.VOTreeNode.showForm(VOTreeNode.java:115)
         at oracle.jbo.jbotester.BaseTree.processTreeMouseClicked(BaseTree.java:471)
         at oracle.jbo.jbotester.BaseTree.mav$processTreeMouseClicked(BaseTree.java:45)
         at oracle.jbo.jbotester.BaseTree$TreeMouseListener.mouseClicked(BaseTree.java:125)
         at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:212)
         at java.awt.Component.processMouseEvent(Component.java:5491)
         at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
         at java.awt.Component.processEvent(Component.java:5253)
         at java.awt.Container.processEvent(Container.java:1966)
         at java.awt.Component.dispatchEventImpl(Component.java:3955)
         at java.awt.Container.dispatchEventImpl(Container.java:2024)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3901)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
         at java.awt.Container.dispatchEventImpl(Container.java:2010)
         at java.awt.Window.dispatchEventImpl(Window.java:1774)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
    ----- LEVEL 1: DETAIL 0 -----
    java.sql.SQLException: Invalid column index
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:138)
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:175)
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:240)
         at oracle.jdbc.driver.OraclePreparedStatement.setNUMBERInternal(OraclePreparedStatement.java:5891)
         at oracle.jdbc.driver.OraclePreparedStatement.setObjectCritical(OraclePreparedStatement.java:7674)
         at oracle.jdbc.driver.OraclePreparedStatement.setCustomDatumInternal(OraclePreparedStatement.java:7410)
         at oracle.jdbc.driver.OraclePreparedStatement.setObjectInternal(OraclePreparedStatement.java:8178)
         at oracle.jdbc.driver.OraclePreparedStatement.setObject(OraclePreparedStatement.java:8166)
         at oracle.jbo.server.BaseSQLBuilderImpl.bindParamValue(BaseSQLBuilderImpl.java:1847)
         at oracle.jbo.server.OracleSQLBuilderImpl.bindParamValue(OracleSQLBuilderImpl.java:3890)
         at oracle.jbo.server.BaseSQLBuilderImpl.bindParametersForStmt(BaseSQLBuilderImpl.java:3335)
         at oracle.jbo.server.ViewObjectImpl.bindParametersForCollection(ViewObjectImpl.java:13759)
         at oracle.jbo.server.QueryCollection.buildResultSet(QueryCollection.java:801)
         at oracle.jbo.server.QueryCollection.executeQuery(QueryCollection.java:666)
         at oracle.jbo.server.ViewObjectImpl.executeQueryForCollection(ViewObjectImpl.java:3655)
         at oracle.jbo.server.OAJboViewObjectImpl.executeQueryForCollection(Unknown Source)
         at oracle.apps.fnd.framework.server.OAViewObjectImpl.executeQueryForCollection(OAViewObjectImpl.java:4560)
         at oracle.jbo.server.ViewRowSetImpl.execute(ViewRowSetImpl.java:742)
         at oracle.jbo.server.ViewRowSetImpl.executeQueryForMasters(ViewRowSetImpl.java:891)
         at oracle.jbo.server.ViewRowSetImpl.executeQueryForMode(ViewRowSetImpl.java:805)
         at oracle.jbo.server.ViewRowSetImpl.executeQuery(ViewRowSetImpl.java:799)
         at oracle.jbo.server.ViewObjectImpl.executeQuery(ViewObjectImpl.java:3575)
         at oracle.apps.fnd.framework.server.OAViewObjectImpl.executeQuery(OAViewObjectImpl.java:439)
         at oracle.jbo.jbotester.VariableDialog.save(VariableDialog.java:144)
         at oracle.jbo.jbotester.GenericDialog.actionPerformed(GenericDialog.java:219)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
         at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:234)
         at java.awt.Component.processMouseEvent(Component.java:5488)
         at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
         at java.awt.Component.processEvent(Component.java:5253)
         at java.awt.Container.processEvent(Container.java:1966)
         at java.awt.Component.dispatchEventImpl(Component.java:3955)
         at java.awt.Container.dispatchEventImpl(Container.java:2024)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
         at java.awt.Container.dispatchEventImpl(Container.java:2010)
         at java.awt.Window.dispatchEventImpl(Window.java:1774)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:153)
         at java.awt.Dialog$1.run(Dialog.java:515)
         at java.awt.Dialog.show(Dialog.java:536)
         at oracle.jbo.jbotester.JTDialog.show(JTDialog.java:121)
         at oracle.jbo.jbotester.JboTesterUtil.editBindParameters(JboTesterUtil.java:169)
         at oracle.jbo.jbotester.SimpleForm.setIterator(SimpleForm.java:65)
         at oracle.jbo.jbotester.SimpleForm.<init>(SimpleForm.java:51)
         at oracle.jbo.jbotester.VOTreeNode.showForm(VOTreeNode.java:115)
         at oracle.jbo.jbotester.BaseTree.processTreeMouseClicked(BaseTree.java:471)
         at oracle.jbo.jbotester.BaseTree.mav$processTreeMouseClicked(BaseTree.java:45)
         at oracle.jbo.jbotester.BaseTree$TreeMouseListener.mouseClicked(BaseTree.java:125)
         at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:212)
         at java.awt.Component.processMouseEvent(Component.java:5491)
         at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
         at java.awt.Component.processEvent(Component.java:5253)
         at java.awt.Container.processEvent(Container.java:1966)
         at java.awt.Component.dispatchEventImpl(Component.java:3955)
         at java.awt.Container.dispatchEventImpl(Container.java:2024)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3901)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
         at java.awt.Container.dispatchEventImpl(Container.java:2010)
         at java.awt.Window.dispatchEventImpl(Window.java:1774)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
    Is there some other configuration I need to do when using positional Bind Variables? If I switch the query to use named parameters and replace :1 with :var1 for example it works fine in the Tester. The reason I am not using named bind variables is that Oracle recommend using positional for eBus, probably because it was predominantly built on older versions of JDev.
    Thanks in advance
    Stacy
    Edited by: Stacy Carpenter on 26-Mar-2013 06:40

    There are actually 2 issues here. The first is that bind positions start at 0 (not 1) and that will resolve the invalid column index issue above. However it seems there is a relatively unknown error in JDeveloper 10.1.3 that keeps resetting the bind position of all bind variables each time you update any of them. So if I create var1 with a position of 0 and then create var2 with a position of 1 then the position of var1 will also be overwritten with 1. I tried listing 0,1 for both to see whether the the IDE would intuitively sort out what was supposed to be where but all that happens is that var2 ends up populating positions 0 and 1, which unless the values are meant to be the same is obviously no good. It seems the only way to get around this in this version of JDeveloper is to close the IDE, edit the VO xml to put the variables against their correct positions, and then reopen. Opening the VO wizard will reset them all to the same again so do not do this (unknowingly) and simply right click the AM and run the BC4J Tester which should now let you edit the bind variables and produce the expected results.
    Cheers
    Stacy

  • Bind variable inside a package

    Can we declare a bind variable inside a package specification?
    CREATE OR REPLACE PACKAGE GET_EMPLOYEEDETAILS
    IS
    PROCEDURE GET_FIRSTNAME(E_ID IN EMPLOYEES.EMPLOYEE_ID%TYPE, F_NAME OUT EMPLOYEES.FIRST_NAME%TYPE);
    VARIABLE O VARCHAR2(20);
    END GET_EMPLOYEEDETAILS ;
    CREATE OR REPLACE PACKAGE BODY GET_EMPLOYEEDETAILS
    IS
    PROCEDURE GET_FIRSTNAME(E_ID IN EMPLOYEES.EMPLOYEE_ID%TYPE, F_NAME OUT EMPLOYEES.FIRST_NAME%TYPE)
    IS
    BEGIN
    SELECT FIRST_NAME INTO F_NAME FROM EMPLOYEES WHERE EMPLOYEE_ID = E_ID;
    DBMS_OUTPUT.PUT_LINE(F_NAME);
    END;
    END GET_EMPLOYEEDETAILS;
    Output:
    ERROR at line 4: PLS-00103: Encountered the symbol "VARCHAR2" when expecting one of the following:
      := . ( @ % ; not null range default character
    The symbol ":=" was substituted for "VARCHAR2" to continue.
    2. IS
    3. PROCEDURE GET_FIRSTNAME(E_ID IN EMPLOYEES.EMPLOYEE_ID%TYPE, F_NAME OUT EMPLOYEES.FIRST_NAME%TYPE);
    4. VARIABLE O VARCHAR2(20);
    5. END GET_EMPLOYEEDETAILS ;
    6. /
    or is there any alternative for bind variables inside an package
    Thanks in advance
    Message was edited by: 1009739

    The "VARIABLE O VARCHAR2(20);" syntax is the way SQLPlus declared bind variables - it is specific to the client. Because PL/SQL packages and procedures are server code that continue past sessions, its only access to the client environment is what the client gives it - it can't go and create a bind variable in the client.
    PL/SQL procedures, functions and packages run from lots of environments, so they cannot access bind variables inside their body - you have to pass any external variables as parameters.
    Anonymous PL/SQL blocks can access bind variables.
    You can declare package public global variables - just leave out that "VARIABLE". E.g.
    CREATE OR REPLACE PACKAGE GET_EMPLOYEEDETAILS
    IS
    PROCEDURE GET_FIRSTNAME(E_ID IN EMP.EMPNO%TYPE, F_NAME OUT EMP.ENAME%TYPE);
    O VARCHAR2(20);
    END GET_EMPLOYEEDETAILS ;
    For local variables in your procedure, just put them between the IS and BEGIN. Using them in SQL inside the PL/SQL automatically uses them as a bind variable.
    create or replace PROCEDURE GET_FIRSTNAME(E_ID IN EMP.EMPNO%TYPE, F_NAME OUT EMP.ENAME%TYPE)
    IS
      O VARCHAR2(20);
      O2 VARCHAR2(21);
    BEGIN
      O := 'FR%';
    SELECT ENAME INTO F_NAME FROM EMP WHERE EMPNO = E_ID and ENAME like O;
    O2 := F_NAME || '2';
    DBMS_OUTPUT.PUT_LINE(F_NAME);
    END;
    O is bound in the query.
    To access bind variables from anonymous PL/SQL, first declare them in the calling environment. In SQL Plus that's
    VARIABLE O VARCHAR2(20);
    In Pro*C it's
    EXEC SQL BEGIN DECLARE SECTION;
      char[21] O
    EXEC SQL END DECLARE SECTION;
    Then reference it in anonymous PL/SQL with a colon as prefix:
    BEGIN
    SELECT FIRST_NAME INTO :O FROM EMPLOYEES WHERE EMPLOYEE_ID = E_ID;
    END;
    This only works for anonymous blocks (starting with BEGIN or DECLARE). As I said, PL/SQL procedures, functions and packages cannot see bind variables from the calling environment

  • Bind variable code takes more time to complete?

    Hello, My database is oracle11g.
    I have same plsql code and first one is without bind variable and second one is with bind variable. Usually, bind variable should take less time. But here
    the bind variable takes more time than the regular code... Can any one please explain why?
    SQL> alter system flush shared_pool;
    System altered.
    SQL> declare
    2 cursor c1 is select * from emp where rownum < 50;
    3 l_start NUMBER DEFAULT DBMS_UTILITY.GET_TIME;
    4 v_cnt number;
    5 begin
    6 for i in c1 loop
    7 SELECT count(*) into v_cnt
    8 FROM rate
    9 WHERE rate_id IN (SELECT rate_id
    10 FROM ratedetail
    11 WHERE benefit_id = i.benefit_id)
    12 AND effective_date =
    13 TO_DATE ('2011-01-23 00:00:00', 'yyyy-MM-dd HH24:MI:SS')
    14 AND rate_type_id = 1;
    15 end loop;
    16 DBMS_OUTPUT.PUT_LINE('total minutes....'||ROUND(ROUND((DBMS_UTILITY.GET_TIME - l_start)/100, 2)
    /60,3));
    17 end;
    18 /
    total minutes.....06
    PL/SQL procedure successfully completed.
    SQL> alter system flush shared_pool;
    System altered.
    SQL>
    SQL> declare
    2 cursor c1 is select benefit_id from emp where rownum < 50;
    3 l_start NUMBER DEFAULT DBMS_UTILITY.GET_TIME;
    4 v_cnt number;
    5 begin
    6 for i in c1 loop
    7 execute immediate 'SELECT count(*)
    8 FROM rate
    9 WHERE rate_id IN (SELECT rate_id
    10 FROM ratedetail
    11 WHERE benefit_id = :x)
    12 AND effective_date = trunc(sysdate)-202
    13 AND rate_type_id = 1'
    14 into v_cnt using i.benefit_id;
    15 end loop;
    16 DBMS_OUTPUT.PUT_LINE('total minutes....'||ROUND(ROUND((DBMS_UTILITY.GET_TIME - l_start)/100, 2)
    /60,3));
    17 end;
    18 /
    total minutes.....061
    PL/SQL procedure successfully completed.
    SQL>

    Shrinika wrote:
    Thanks for the clarification.. Now i understand...
    One final question on this thread before i close this thread....
    My database is set to CURSOR_SHARING=FORCE for some reason. It seems somebody applied a "quick and dirty fix" to "database is slow" problem. BAD PRACTICE
    My question is, when we use bind variable, does it parse the sql code every time? or does it reuse the execution plan?
    In my database, it reuse the execution plan... Just checking... When we set CURSOR_SHARING=FORCE, it should generate the execution plan
    for every unqiue sql code... Is that correct? Am i confusing?If by "parse" you mean a "hard parse" (which generates execution plan), then the answer is NO. As you observed, it reuses execution plan.
    For e.g. with CURSOR_SHARING=FORCE setting, following SQLs
    select employee_no, first_name, last_name from employees where dept_no = 10 ;and
    select employee_no, first_name, last_name from employees where dept_no = 20 ;would tend to reuse the same execution plan since both of these will be rewritten by oracle (before execution) as
    select employee_no, first_name, last_name from employees where dept_no = :SYS01 ;Hope this helps.
    Edited by: user503699 on Aug 14, 2010 3:55 AM

  • Use of bind variables with the oracle db - to improve library cache perform

    Dear Friends,
    We are using oracle 9.0.1.1.1 db server - the performance of the db was pathetic and upon investigation it was revealed that the library cache was over loaded with sql hard parses generated by not using bind variables. We are using vb as a front end with oracle and our connection object in vb is created using ole db for oracle provided by oracle (installed from oracle client custom - programmer option).
    I would appreciate if any body can tell how can we use bind variables in vb to connect to oracle such that the hard parses can be changed into soft parses.
    Your effort to bring some peace in my life is worth comendable and I would be very obliged for your time and help.
    Thanks a lot.
    Bye
    Take care.
    qj

    Generally, you would use bind variables by changing statements that are written like this
    select * from emp where empno=6678 and ename='Jones'
    so that they're written like
    select * from emp where empno=? and ename=?
    How you then bind these question marks to the particular values you want depends on the API you're using (ADO? OLE DB directly?, etc). If you have a support contract, there are plenty of examples for any API on metalink.oracle.com
    Justin

  • How to pass a value to a bind variable in a query report in oracle apex

    Hi Guys,
    I have requirement to send weekly reports via email to some users. The users should receive their own records in the report. The user details is stored in a table. What I am planning to do is to create a report query in oracle apex to generate the report and then run a function/procedure via a scheduler to email the report to respective users. Now my query is ............. is it possible to pass a value (user name) to the report query to pull records of only that user? I know we can have bind variables in the report query but I have no idea how to pass a value for bind variables from a function/procedure.
    Can anyone help me on this issue or suggest a better approach?
    Thanks,
    San

    You need to use dynamic sql
    But please keep in mind that since you're using Oracle you may be better off posting this in some Oracle forums
    This forum is specifically for SQL Server
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • How to use sql "IN" operator with named bind variable in where clause ?

    Can one bind variable be used for the "IN" list ('1','2','3') ?

    rob,
    No worries. Glad it helped. Glad to see also that you're doing things right and trying to use bind variables ;)
    May I suggest adding "SOLVED" to the title of the original post?
    Best,
    John

  • Re-using bind variables in Pro*C

    Using dynamic SQL method 4. Application originally written back in, oh 1999-ish, using Oracle 7. We've upgraded to Oracle 10g. I've looked through the old manuals ( Pro*C Supplement to the ORACLE Precompilers Guide Version 1.5) for an answer to a question and can't find it in the old manuals. I haven't tried looking through the online manuals for the newer version yet, so if the answer is readily available there I apologize.
    The question is, "Can a bind variable be used more than once within a SQL command?"
    Example: find all employees whose first or last name is not Lee.
    SELECT first_name, last_name
    FROM employee
    WHERE first_name <> :criteria1
    AND last_name <> :criteria2;
    In an example like this, both bind variables contains the same value (Lee). Is it still required to have separate bind variables? Or could I re-use a bind variable, like this:
    SELECT first_name, last_name
    FROM employee
    WHERE first_name <> :criteria1
    AND last_name <> :criteria1;
    Obviously, this is a simplified example. In my application, there are some large unioned SQL statements that re-use the user's id over a dozen times. It would be nice to use just one bind variable repeatedly, rather than having ":userid1, :userid2, :userid3, ..., userid12".
    Thanks in advance,
    Darren

    Got it... you mean, do I ever use a bind variable to store the result of a SQL statement (query). Answer is no, the bind variables are always criteria that are used by the SQL. Output is obtained by using FETCH.
    So I ought to be safe then.
    Thank you,
    Darren

  • Bind variables in SQL Developer

    I declared a bind variable called 'test_num' and assigned a value of 10 as shown below.
    variable test_num number
    BEGIN
    :test_num := 10;
    dbms_output.put_line ('The Test Value: ' || :test_num);
    END;
    When I execute the above program, the output is thrown as 'The Test Value: '. The value of test_num is not shown. I fear whether this issue is due to SQL Developer which i am using to execute this program.
    Please let me know why the value is not getting printed
    Thanks for your help!

    I see the same issue you are seeing when using the bind variable. The bind variable works fine in SQL*Plus but not from SQL Developer.
    From SQLPlus*
    SQL> set serveroutput on
    SQL> variable test_num number
    SQL> BEGIN
    2 :test_num := 10;
    3 dbms_output.put_line ('The Test Value: ' || :test_num);
    4 END;
    5 /
    The Test Value: 10
    PL/SQL procedure successfully completed.
    From SQLDeveloper*
    set serveroutput on
    variable test_num number
    BEGIN
    :test_num := 10;
    dbms_output.put_line ('The Test Value: ' || :test_num);
    END;
    anonymous block completed
    The Test Value:

  • Bug: ADF BC VO bind variable attr editor control hints

    Hi JDev team
    Under JDev 11g TP, for an ADF BC VO "existing" bind variable in the VO editor, if you double click on the variable, and in the bind variable editor change any of the control hints, press ok, on returning to the bind variable control hints in the editor, your changes have disappeared.
    Regards,
    CM.

    Hi ,
    I like to fill the date properties of a data variable what do I need to do tow make it work , do I need to edit the vo.xml or do I make a resourcebundle
    thanks

Maybe you are looking for