Inserting a LINESTRING with a bind variable

Hello - I am trying to insert a LINESTRING with a bind variable. Here is my query that works:
INSERT INTO EDGE (pts)
VALUES (SDO_GEOMETRY('LINESTRING(-71.110157 42.513495, -71.110159 42.51359)',8307));
But if I want to pass in the pts as a bind variable, as follows:
INSERT INTO EDGE (pts)
VALUES (SDO_GEOMETRY(LINESTRING(:pts),8307));
When prompted in sqlDeveloper I set the bind variable to: -71.110157 42.513495, -71.110159 42.51359
I get the following error: PLS-306: wrong number of types of arguments.
Thanks!

Thanks - Your reply worked well, but I ran into another snag. If the linestring is greater than 4000 chars, I get another error.
ORA-01461: can bind a LONG value only for insert into a LONG column
Are there any work arounds for this?? Below is the string I am using for the bind/insert:
LINESTRING(
6.169746 50.348667,6.169377 50.348584,6.168800 50.348460,6.168807 50.348434,
6.168901 50.348392,6.168972 50.348330,6.168994 50.348279,6.168985 50.348228,
6.168896 50.348179,6.168784 50.348150,6.168664 50.348151,6.168569 50.348183,
6.168460 50.348251,6.168366 50.348257,6.168278 50.348243,6.168197 50.348184,
6.168052 50.348109,6.167844 50.348082,6.167660 50.348059,6.167611 50.348019,
6.167600 50.347887,6.167544 50.347873,6.167432 50.347869,6.167338 50.347921,
6.167093 50.348021,6.166934 50.348044,6.166768 50.348062,6.166625 50.348084,
6.166568 50.348065,6.166487 50.347984,6.166261 50.347901,6.166006 50.347879,
6.165871 50.347912,6.165865 50.347968,6.165883 50.348059,6.165868 50.348090,
6.165755 50.348041,6.165562 50.347993,6.165450 50.347974,6.165355 50.347980,
6.165253 50.348048,6.165263 50.348109,6.165328 50.348184,6.165282 50.348231,
6.165218 50.348252,6.165148 50.348319,6.165166 50.348395,6.165135 50.348431,
6.165032 50.348463,6.164905 50.348460,6.164818 50.348507,6.164701 50.348610,
6.164615 50.348647,6.164551 50.348648,6.164478 50.348614,6.164421 50.348548,
6.164276 50.348484,6.164164 50.348471,6.163996 50.348468,6.163919 50.348550,
6.163863 50.348572,6.163808 50.348577,6.163727 50.348548,6.163678 50.348498,
6.163636 50.348417,6.163546 50.348301,6.163457 50.348267,6.163337 50.348254,
6.163249 50.348235,6.163192 50.348200,6.163175 50.348139,6.163206 50.348103,
6.163278 50.348102,6.163446 50.348130,6.163557 50.348139,6.163637 50.348122,
6.163644 50.348092,6.163602 50.348026,6.163482 50.347982,6.163393 50.347922,
6.163316 50.347907,6.163249 50.347894,6.163026 50.347907,6.162725 50.347983,
6.162319 50.348029,6.161930 50.348081,6.161645 50.348130,6.161526 50.348183,
6.161512 50.348265,6.161593 50.348304,6.161667 50.348379,6.161693 50.348491,
6.161736 50.348587,6.161817 50.348662,6.161922 50.348691,6.162050 50.348720,
6.162050 50.348735,6.161963 50.348757,6.161933 50.348833,6.161871 50.348885,
6.161744 50.348928,6.161435 50.348978,6.161293 50.349026,6.161262 50.349067,
6.161264 50.349148,6.161194 50.349225,6.161180 50.349297,6.161246 50.349372,
6.161271 50.349438,6.161194 50.349536,6.161059 50.349568,6.160987 50.349549,
6.160953 50.349478,6.160949 50.349300,6.160915 50.349240,6.160850 50.349185,
6.160730 50.349156,6.160627 50.349173,6.160470 50.349292,6.160369 50.349380,
6.160331 50.349451,6.160316 50.349482,6.160268 50.349488,6.160219 50.349443,
6.160131 50.349434,6.160045 50.349506,6.159926 50.349539,6.159839 50.349530,
6.159669 50.349466,6.159493 50.349428,6.159278 50.349411,6.159237 50.349381,
6.159220 50.349325,6.159266 50.349278,6.159322 50.349278,6.159426 50.349292,
6.159594 50.349325,6.159649 50.349304,6.159640 50.349243,6.159567 50.349193,
6.159326 50.349130,6.159142 50.349107,6.159078 50.349078,6.159068 50.348986,
6.159074 50.348925,6.159050 50.348895,6.158905 50.348841,6.158722 50.348844,
6.158532 50.348908,6.158368 50.349032,6.158345 50.349088,6.158319 50.349297,
6.158201 50.349375,6.158122 50.349392,6.158057 50.349377,6.157977 50.349353,
6.157874 50.349370,6.157565 50.349466,6.156989 50.349667,6.156790 50.349685,
6.156702 50.349682,6.156550 50.349648,6.156383 50.349651,6.156230 50.349612,
6.156095 50.349599,6.156040 50.349635,6.156025 50.349706,6.156059 50.349777,
6.156188 50.349852,6.156246 50.349912,6.156208 50.350009,6.156130 50.350051,
6.155971 50.350089,6.155940 50.350120,6.155925 50.350155,6.155975 50.350221,
6.156137 50.350300,6.156140 50.350407,6.156118 50.350504,6.155938 50.350633,
6.155742 50.350763,6.155647 50.350780,6.155559 50.350771,6.155486 50.350737,
6.155469 50.350686,6.155491 50.350604,6.155552 50.350507,6.155549 50.350380,
6.155522 50.350304,6.155438 50.350290,6.155343 50.350321,6.155273 50.350387,
6.155197 50.350465,6.155157 50.350534,6.155038 50.350574,6.154890 50.350603,
6.154675 50.350606,6.154411 50.350587,6.154088 50.350565,6.153878 50.350522,
6.153637 50.350468,6.153367 50.350438,6.153135 50.350464,6.152772 50.350519,
6.152581 50.350529,6.152377 50.350513,6.152038 50.350445,6.151744 50.350396,
6.151587 50.350356,6.151550 50.350303,6.151542 50.350239,6.151512 50.350193,
6.151445 50.350168,6.151355 50.350157,6.151240 50.350087,6.151102 50.350073,
6.150917 50.350095,6.150792 50.350104,6.150714 50.350075,6.150634 50.349996,
6.150627 50.349950,6.150590 50.349901,6.150529 50.349879,6.150368 50.349897,
6.150267 50.349894,6.150194 50.349846,6.150180 50.349781,6.150184 50.349697,
6.150176 50.349613,6.150113 50.349504,6.149984 50.349418,6.149737 50.349330,
6.149503 50.349287,6.149288 50.349290,6.149097 50.349335,6.148890 50.349407,
6.148666 50.349521,6.148502 50.349660,6.148486 50.349725,6.148511 50.349778,
6.148572 50.349823,6.148609 50.349869,6.148610 50.349918,6.148546 50.349988,
6.148392 50.350043,6.148126 50.350150,6.148036 50.350163,6.147970 50.350145,
6.147957 50.350111,6.147966 50.349973,6.148038 50.349770,6.148167 50.349673,
6.148279 50.349599,6.148290 50.349545,6.148252 50.349465,6.148161 50.349425,
6.148065 50.349403,6.147947 50.349455,6.147900 50.349509,6.147801 50.349609,
6.147620 50.349791,6.147555 50.349811,6.147460 50.349839,6.147366 50.349909,
6.147313 50.349948,6.147236 50.349957,6.147140 50.349947,6.147079 50.349902,
6.147053 50.349811,6.147002 50.349701,6.146936 50.349675,6.146846 50.349684,
6.146745 50.349712,6.146603 50.349764,6.146472 50.349781,6.146251 50.349761,
6.146131 50.349778,6.146037 50.349818,6.146020 50.349871,6.146045 50.349909,
6.146154 50.349965,6.146317 50.350031,6.146426 50.350068,6.146450 50.350105,
6.146409 50.350140,6.146338 50.350145,6.146145 50.350094,6.145899 50.350045,
6.145797 50.350046,6.145709 50.350085,6.145675 50.350189,6.145671 50.350258,
6.145624 50.350293,6.145487 50.350321,6.145290 50.350324,6.145153 50.350318,
6.145026 50.350282,6.144929 50.350207,6.144856 50.350159,6.144754 50.350149,
6.144653 50.350165,6.144504 50.350206,6.144427 50.350214,6.144349 50.350200,
6.144249 50.350143)

Similar Messages

  • How do I refresh a table with a bind variable using a return listener?

    JDev 11.1.2.1.0.
    I am trying to refresh a table with a bind variable after a record is added.
    The main page has a button which, on click, calls a task flow as an inline document. This popup task flow allows the user to insert a record. It has its own transaction and does not share data controls.
    Upon task flow return, the calling button's return dialog listener is invoked which should allow the user to see the newly created item in the table. The returnListener code:
        // retrieve the bind variable and clear it of any values used to filter the table results
        BindingContainer bindings = ADFUtils.getBindings();
        AttributeBinding attr = (AttributeBinding)bindings.getControlBinding("pBpKey");
        attr.setInputValue("");
        // execute the table so it returns all rows
        OperationBinding operationBinding = bindings.getOperationBinding("ExecuteWithParams");
        operationBinding.execute();
        // set the table's iterator to the newly created row
        DCIteratorBinding iter = (DCIteratorBinding) bindings.get("AllCustomersIterator");
        Object customerId = AdfFacesContext.getCurrentInstance().getPageFlowScope().get("newCustomerId");
        iter.setCurrentRowWithKeyValue((String)customerId);
        // refresh the page
        AdfFacesContext.getCurrentInstance().addPartialTarget(this.getFilterText());
        AdfFacesContext.getCurrentInstance().addPartialTarget(this.getCustomerTable());But the table does not refresh ... The bind variable's inputText component is empty. The table flickers as if it updates. But no new values are displayed, just the ones that were previously filtered or shown.
    I can do the EXACT SAME code in a button's actionListener that I click manually and the table will refresh fine. I'm really confused and have spent almost all day on this problem.
    Will

    Both options invoke the create new record task flow. The first method runs the "reset" code shown above through the calling button's returnListener once the task flow is complete. The second method is simply a button which, after the new record is added and the task flow returns, runs the "reset" code by my clicking it manually.
    I'm thinking that the returnListener code runs before some kind of automatic ppr happens on the table. I think this because the table contents flicker to show all customers (like I intend) but then goes back to displaying the restricted contents a split second later.
    Yes, the table is in the page that invokes the taskflow.
    Here are some pictures:
    http://williverstravels.com/JDev/Forums/Threads/2337410/Step1.jpg
    http://williverstravels.com/JDev/Forums/Threads/2337410/Step2.jpg
    http://williverstravels.com/JDev/Forums/Threads/2337410/Step3.jpg
    Step1 - invoke new record task flow
    Step2 - enter data and click Finish
    Step3 - bind parameter / table filter cleared. Table flickers with all values. Table reverts to previously filterd values.

  • How to call a report with a bind variable from a multi-record block

    Hi,
    I have created a report using the BI Publisher functionality. I did all the integration, created the SQL Query and uploaded the template. Up till here everythings fine!
    My SQL Query has 2 bind variables.
    I will call my report from a multi record block, at the end of each record an icon is shown which the user can click to open the report.
    I created a column link for this item (PRINT_REPORT=Inschrijvingsformulier) but I do not manage to pass the parameters to my report. The parameters I want to pass are 2 columns in this Multi Record block.
    I created 2 hidden fields on the page P9_PARAMETER1, P9_PARAMETER2 with the same names as my bind variables and fill this in with the values #PARAMETER1#, #PARAMETER2# from the multi record block.
    It seems it does not work as my report stays empty. (also XML file stays empty).
    Am I trying the wrong way?
    Thanks for any advice,
    Kris

    hi khadeer,
         create one report program and write the required code,and call this function module 'SSF_FUNCTION_MODULE_NAME' and give your smartform name  and also when u activate ur smart form u will get one function module call that function module also and specify any tables used...
    i think this solves ur problem...
    any queries revert back..
    pls reward points if helpful,
    shylaja

  • "Partition For" with a bind variable

    Does anyone know if a bind variable can be used with the "partition for" syntax? For example,
    select max(col1) into myvar from t partition for (mydate);where t is an interval-partitioned table.
    I couldn't find any documentation specifically on this and all the ways I've tried it have failed :-(
    Edit: version 11.2

    The table has an interval partition on a date column so that all records for a particular day are stored in the same partition. The query is actually the equivalent of
    select max(col1) into myvar from t
    where date_col >= trunc(mydate) and date_col < trunc(mydate+1);but I'd rather use the shorter statement if possible.

  • Is there a problem using popup LOVs in a portal form with a bind variable?

    I have a portal form with 2 LOVs. The second LOV is a dependent LOV whose bind variable can be NULL. I have read Note 263923.1, "How To Create Dependent Lovs In Forms", and my form works as long as I use combo boxes to display the LOVs. I need to use popups so the user can search the LOVs as they are quite lengthy. Plus I want to be able to pick a value from my second LOV without selecting a value from the first LOV -- hence, my bind variable can be null and that is where my problem lies. As long as I select a value from the first LOV, the second LOV popup will work. If I click on the icon to display the second LOV without pre-selected a value from the first LOV, I get the following error:
    POPUP LOV ERROR:
    LOV: "9A17692880B6B8509F514F5B9CA9EC808DD403218B3CF19A33C04CD1FAB0ADE17ADC33E6B67998A933357CE5264D204E"
    Parse Message: Parse as pre-set global: "TORE".
    Find Message: LOV is of type DYNAMIC (LOV based on SQL query).
    Query: "SELECT ...."
    wwv_bind.prepare_bind: ORA-01403: no data found
    My form is based on a table with a custom layout. The sql for the second LOV is similar to: SELECT ENAME, EMPNO FROM SCOTT.EMP WHERE (DEPTNO = :DEPT AND :DEPT IS NOT NULL) OR :DEPT IS NULL.
    Thanks in advance for any help,
    Carol

    Don't use EPS any more! It does not support transparency nor color management.
    If you save vector files from Illustrator, use AI with PDF compatiblity.
    If you save image files from Photoshop, use PSD.
    If you save image files combined with vector forms and/or text from Photoshop, use PDP which is a Photoshop PDF.
    For vectors from Illustrator use CMYK files.
    For images use RGB, conversion to CMYK should never done before PDF export, better, if the printer allows it, is to export a PDF with live transparency as it is PDF/X-4
    If the printer requires a PDF with CMYK only export a PDF/X-1a.

  • 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

  • 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

  • What is bad with this bind variable.

    i get a error bad bind variables. i dunno what is bad here.
    FUNCTION DisturbrLoops(i_currTerm IN NUMBER,
                              i_Termoutofloop IN Merc.T_NUMLIST,
                              i_currentTermonloop IN Merc.T_NUMLIST) 
                              RETURN NUMBER is
    v_sql        VARCHAR2(1000);
    cntLoops NUMBER;
    BEGIN
      BEGIN
      select count(distinct assoc1.loopid)
          from ndw_segment                  ns1,
             ndw_loop_segment_association assoc1,
             ndw_loop_segment_association assoc2,
             ndw_segment                  ns2
        where ns1.termsysid = :i_currTerm
         and ns1.segment_id = assoc1.segment_id         
         and assoc1.loopid = assoc2.loopid
         and assoc2.segment_id = ns2.segment_id
         and ns2.termsysid in
             (SELECT * FROM TABLE(CAST(:i_Termoutofloop AS Merc.T_NUMLIST)))
         and ns2.termsysid NOT in /*(1,2,3,4)*/
            (SELECT *
                FROM TABLE(CAST(:i_currentTermonloop AS Merc.T_NUMLIST)));
        EXECUTE IMMEDIATE v_sql
                BULK COLLECT INTO cntLoops 
                USING i_currTerm ,i_Termoutofloop ,i_currentTermonloop;
    /*  dbms_output.put_line(v_Termoutofloop.count);*/
      EXCEPTION
        WHEN OTHERS THEN
         -- catch all errors. what to do.
         dbms_output.put_line( SQLERRM || ' ' || SQLCODE);
        null;
      END;
    return cntLoops ;
    END DisturbrLoopsEdited by: user8798946 on Sep 14, 2009 1:45 AM

    In PL/SQL syntax there is no colon or any other symbol in front of a variable name. Just use <tt>i_currterm</tt>, <tt>i_termoutofloop</tt> etc.

  • How do I use setString() method with multiple bind variables

    I have two setString() statements and a select union statement. My class compiles but only displays the data for the first table ignoring the second setString() statement. But When I replace the "where id=?" with "where id=12 or someid", it works and displays all data found in both tables.
    Am I not properly using the setString() method?
    public class LdData{
    private String id;
    public LdData(){
    public void setId(String id)
        this.id = id;
      public String getId()
        return id;
    public Collection getLdData() throws Exception{
                    List rows = new ArrayList();
    //connection statement
    String sql_query="SELECT a,b FROM table1 WHERE id = ? " + " UNION " + "SELECT a,b FROM table2 WHERE id= ?";
    try {
                            conn = ds.getConnection();
    pstmt = conn.prepareStatement( sql_query );
    pstmt.setString(1, this.id);
    pstmt.setString(2, this.id);
    rst = pstmt.executeQuery();
    while (rst.next()) {
    //dataEntry.java - contains my getter and setter
    dataEntry info = new dataEntry(rst.getString("a"), rst.getString("b"), this.id);
    rows.add(info);
    //catch all SQLexceptions, NamingExceptions
    //close all connection
    return rows;
    //dataEntry.java - dataEntry class
    private String a;
    private String b;
    private String id;
    public dataEntry(String a, String b, String id){
    seta(a);
    setb(b);
    setbdate(bcode);
    this.a = a;
    this.b = b;
    this.id = id;
    public String getA(){
    return a;
    public String getB(){
    return b;
    public String getId(){
    return id;
    public void setA(String a){
    this.a = a;
    public void setB(String b){
    this.b = b;
    public void setId(String id){
    this.id = id;
    //index.jsp - displays data
    <jsp:useBean id="test" class="lddata" scope="request">
    <jsp:setProperty name="test" property="id" param="id"/>
    </jsp:useBean>
    <display:table name="${test.lddata}"/>

    This just doesnt make sense to me at all. :( Could it be a naming issue? I mean both tables have the same field names but different data information
    so the union will never sort and choose. And the weirdest thing is that
    //this works -
    ->String sql_query="SELECT a,b FROM table1 WHERE id = TU234 " + " UNION ALL" + "SELECT a,b FROM table2 WHERE id= TU234";
    //I also tried this, but the second statement doesnt work
    ->pstmt.setString(1, "TU234"); //this works.
    ->pstmt.setString(2, "TU234"); //this doesnt
    //It also tried this, it worked for both set statements, but I need it in an list or so.
    while (rst.next()) {
    String a = rst.getString(a);
    String b = rst.getString(b);
    String id = rst.getString(id);
    System.out.println(a+""+b+""+id);
    }Is there anyother way I can collect the data into a jsp page without using javabean?

  • SLOW report performance with bind variable

    Environment: 11.1.0.7.2, Apex 4.01.
    I've got a simplified report page where the report runs slowly compared to running the same query in sqldeveloper. The report region is based on a pl/sql function returning a query. If I use a bind variable in the query inside apex it takes 13 seconds to run, and if I hard code a string it takes only a few hundredths of a second. The query returns one row from a table which has 1.6 million rows. Statistics are up-to-date and the columns in the joins and where clause are indexed.
    I've run traces using p_trace=YES from Apex for both the bind variable and hard coded strings. They are below.
    The sqldeveloper explain plan is identical to the bind variable plan from the trace, yet the query runs in 0.0x seconds in sqldeveloper.
    What is it about bind variable syntax in Apex that is causing the bad execution plan? Apex Bug? 11g bug? Ideas?
    tkprof output from Apex trace with bind variable is below...
    select p.master_id link, p.first_name||' '||p.middle_name||' '||p.last_name||' '||p.suffix personname,
    p.gender||' '||p.date_of_birth g_dob, p.master_id||'*****'||substr(p.ssn,-4) ssn, p.status status
    from persons p
    where
       p.person_id in (select ps.person_id from person_systems ps where ps.source_key  like  LTRIM(RTRIM(:P71_SEARCH_SOURCE1)))
    order by 1
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1      0.00       0.01          0          1         27           0
    Fetch        2     13.15      13.22      67694      72865          0           1
    total        4     13.15      13.23      67694      72866         27           1
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 62  (ODPS_PRIVACYVAULT)   (recursive depth: 1)
    Rows     Row Source Operation
          1  SORT ORDER BY (cr=72869 pr=67694 pw=0 time=0 us cost=29615 size=14255040 card=178188)
          1   FILTER  (cr=72869 pr=67694 pw=0 time=0 us)
          1    HASH JOIN RIGHT SEMI (cr=72865 pr=67694 pw=0 time=0 us cost=26308 size=14255040 card=178188)
          1     INDEX FAST FULL SCAN IDX$$_0A300001 (cr=18545 pr=13379 pw=0 time=0 us cost=4993 size=2937776 card=183611)(object id 68485)
    1696485     TABLE ACCESS FULL PERSONS (cr=54320 pr=54315 pw=0 time=21965 us cost=14958 size=108575040 card=1696485)
    Rows     Execution Plan
          0  SELECT STATEMENT   MODE: ALL_ROWS
          1   SORT (ORDER BY)
          1    FILTER
          1     HASH JOIN (RIGHT SEMI)
          1      INDEX   MODE: ANALYZED (FAST FULL SCAN) OF
                     'IDX$$_0A300001' (INDEX)
    1696485      TABLE ACCESS   MODE: ANALYZED (FULL) OF 'PERSONS' (TABLE)
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      db file scattered read                       1276        0.00          0.16
      db file sequential read                       812        0.00          0.02
      direct path read                             1552        0.00          0.61
    ********************************************************************************Here's the tkprof output with a hard coded string:
    select p.master_id link, p.first_name||' '||p.middle_name||' '||p.last_name||' '||p.suffix personname,
    p.gender||' '||p.date_of_birth g_dob, p.master_id||'*****'||substr(p.ssn,-4) ssn, p.status status
    from persons p
    where
       p.person_id in (select ps.person_id from person_systems ps where ps.source_key  like  LTRIM(RTRIM('0b')))
    order by 1
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.02       0.04          0          0          0           0
    Execute      1      0.00       0.00          0          0         13           0
    Fetch        2      0.00       0.00          0          8          0           1
    total        4      0.02       0.04          0          8         13           1
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 62  (ODPS_PRIVACYVAULT)   (recursive depth: 1)
    Rows     Row Source Operation
          1  SORT ORDER BY (cr=10 pr=0 pw=0 time=0 us cost=9 size=80 card=1)
          1   FILTER  (cr=10 pr=0 pw=0 time=0 us)
          1    NESTED LOOPS  (cr=8 pr=0 pw=0 time=0 us)
          1     NESTED LOOPS  (cr=7 pr=0 pw=0 time=0 us cost=8 size=80 card=1)
          1      SORT UNIQUE (cr=4 pr=0 pw=0 time=0 us cost=5 size=16 card=1)
          1       TABLE ACCESS BY INDEX ROWID PERSON_SYSTEMS (cr=4 pr=0 pw=0 time=0 us cost=5 size=16 card=1)
          1        INDEX RANGE SCAN IDX_PERSON_SYSTEMS_SOURCE_KEY (cr=3 pr=0 pw=0 time=0 us cost=3 size=0 card=1)(object id 68561)
          1      INDEX UNIQUE SCAN PK_PERSONS (cr=3 pr=0 pw=0 time=0 us cost=1 size=0 card=1)(object id 68506)
          1     TABLE ACCESS BY INDEX ROWID PERSONS (cr=1 pr=0 pw=0 time=0 us cost=2 size=64 card=1)
    Rows     Execution Plan
          0  SELECT STATEMENT   MODE: ALL_ROWS
          1   SORT (ORDER BY)
          1    FILTER
          1     NESTED LOOPS
          1      NESTED LOOPS
          1       SORT (UNIQUE)
          1        TABLE ACCESS   MODE: ANALYZED (BY INDEX ROWID) OF
                       'PERSON_SYSTEMS' (TABLE)
          1         INDEX   MODE: ANALYZED (RANGE SCAN) OF
                        'IDX_PERSON_SYSTEMS_SOURCE_KEY' (INDEX)
          1       INDEX   MODE: ANALYZED (UNIQUE SCAN) OF 'PK_PERSONS'
                      (INDEX (UNIQUE))
          1      TABLE ACCESS   MODE: ANALYZED (BY INDEX ROWID) OF
                     'PERSONS' (TABLE)

    Patrick, interesting insight. Thank you.
    The optimizer must be peeking at my bind variables with it's eyes closed. I'm the only one testing and I've never passed %anything as a bind value. :)
    Here's what I've learned since my last post:
    I don't think that sqldeveloper is actually using the explain plan it says it is. When I run explain plan in sqldeveloper (with a bind variable) it shows me the exact same plan as Apex with a bind variable. However, when I run autotrace in sqldeveloper, it takes a path that matches the hard coded values, and returns results in half a second. That autotrace run is consistent with actually running the query outside of autotrace. So, I think either sqldeveloper isn't really using bind variables, OR it is using them in some other way that Apex does not, or maybe optimizer peeking works in sqldeveloper?
    Using optimizer hints to tweak the plan helps. I've tried both /*+ FIRST_ROWS */ and /*+ index(ps pk_persons) */ and both drop the query to about a second. However, I'm loath to use hints because of the very dynamic nature of the query (and Tom Kyte doesn't like them either). The hints may end up hurting other variations on the query.
    I also tested the query by wrapping it in a select count(1) from ([long query]) and testing the performance in sqldeveloper and in Apex. The performance in that case is identical with both bind variables and hard coded variables for both Apex and SqlDeveloper. That to me was very interesting and I went so far as to set up two bind variable report regions on the same page. One region wrapped the long query with select count(1) from (...) and the other didn't. The wrapped query ran in 0.01 seconds, the unwrapped took 15ish seconds with no other optimizations. Very strange.
    To get performance up to acceptable levels I have changed my function returning query to:
    1) Set the equality operator to "=" for values without wildcards and "like" for user input with wildcards. This makes a HUGE difference IF no wildcard is used.
    2) Insert a /*+ FIRST_ROWS */ hint when users chose the column that requires the sub-query. This obviously changes the optimizer's plan and improves query speed from 15 seconds to 1.5 seconds even with wildcards.
    I will NOT be hard coding any user supplied values in the query string. As you can probably tell by the query, this is an application where sql injection would be very bad.
    Jeff, regarding your question about "like '%' || :P71_SEARCH_SOURCE1 || '%'". I've found that putting wildcards around values, particularly at the beginning will negate any indexing on the column in question and slows performance even more.
    I'm still left wondering if there isn't something in Apex that is breaking the optimizer "peeking" that Patrick describes. Perhaps something in the way it switches contexts from apex_public_user to the workspace schema?

  • Bind variable with Oracle sequence

    can we insert oracle sequence with the bind varaible
    some thing like
    seq       number(5);
    begin
    select myseq.nextval
            into seq        from dual;
    dbms_sql.parse( l_cursor,insert into mytable (c1,c2,c3) values (seq,:1,:2),dbms_sql.native );
    dbms_sql.bind_variable( l_cursor, :1,58);
    dbms_sql.bind_variable( l_cursor, :2,9);
    l_status := dbms_sql.execute( l_cursor );
    end;
    Thanks!

    What are you trying there..
    Why dynamic SQL?
    Where is the exception block?
    you have to use 'using ' to work with these kind of dynamic variables. Something like this (ugly code below)
    CREATE SEQUENCE myseq;
    create table mytable (c1 number,c2 number, c3 number;
    DECLARE
       seq   NUMBER (5);
       A number;
       b NUMBER;
    BEGIN
       SELECT myseq.NEXTVAL INTO seq FROM DUAL;
       a := 1;
       b := 58;
       EXECUTE IMMEDIATE 'insert into mytable (c1,c2,c3) values (:seq,:1,:2)'
          USING seq, a, b;
       a := 1;
       b := 100;
       EXECUTE IMMEDIATE 'insert into mytable (c1,c2,c3) values (:seq,:1,:2)'
          USING seq, a, b;
       COMMIT;
    END;  --- Check you need to have proper exception block.
    Cheers,
    Manik.

  • Collection with bind variable

    Hello all,
    this might be more of a pl sql question but I am trying to create a collection in apex where the query uses a bind variable. I cannot get this query to work.
    This works
    p_query => 'select je_batch_id from gl_je_batches where default_period_name = ''MAY-10''',
    but I cannot get it to work with a bind variable.
    p_query => 'select je_batch_id from gl_je_batches where default_period_name = :P14_EPSB_ARGYLL_PERIODS ||',
    any assistance would be greatly appreciated.
    Thanks

    For the record, the APEX_COLLECTION package in Application Express 4.0 now does support bind variables in the query.
    APEX_COLLECTION.CREATE_COLLECTION_FROM_QUERY_B and APEX_COLLECTION.CREATE_COLLECTION_FROM_QUERYB2 support an input array of bind variable names and bind variable values. This should be faster than referencing an item value via the v() function. However, prior to APEX 4.0, this is the only recourse.
    Joel

  • Report query with bind variable

    Trying to create a report query for xsl-fo print. For output format I pick "derive from item" then pick the item name from the list, on the next screen, I paste the query with the bind variable. on the next step test query, I always get "data not found" regardless what value I type in. This is the same query that I ran under sql commands without any issues.
    Does anyone run into the same issue as I have when attempted to create a query with bind var ? There is no problem creating a query without bind varibles. . thanks.
    Munshar

    Hi, please did you get any solution to this issue? I am having similar challenge right now.
    select     EMP.DEPTNO as DEPTNO,
         DEPT.DNAME as DNAME,
         EMP.EMPNO as EMPNO,
         EMP.ENAME as ENAME,
         EMP.JOB as JOB,
         EMP.MGR as MGR,
         EMP.HIREDATE as HIREDATE,
         EMP.SAL as SAL
    from     SCOTT.DEPT DEPT,
         SCOTT.EMP EMP
    where EMP.DEPTNO=DEPT.DEPTNO
    and      DEPT.DNAME =upper(:dname)
    This run perfectly in sql developer, toad, and even inside publisher if I login directly to publisher to create report.
    Generating this same query in shared component query builder and testing it returns no data found. If I remove the last line, it works. but with the last line, it return no data found. It seems no one has been able to provide solution to this issue

  • How to use List of values with bind variables on item?

    Hi
    I made a dynamic list of values with a bind variable as a provider. I tried to run the list, and it worked fine - i filled inn the bind variable when asked for, and i got a list of values to choose from.
    I would very much like to use this list of values as an attribute on a custom made item. My wish is that when creating the item you someplace write the bind variable, and the list will then turn up as wanted. (I could f.ex add the variable as an attribute on the page type)
    I tried to create a custom attribute and assign the list of values to it. It created an error when I then tried to add the attribute to the item.
    Does anyone have any idea on how to solve this?
    Any help appreciated!
    Maja R. Anjer

    Hi
    i am getting error as
    oracle.apps.fnd.framework.OAException: oracle.jbo.SQLStmtException: JBO-27122: SQL error during statement preparation. Statement: SELECT * FROM (SELECT meaning, lookup_code,lookup_type
    FROM fnd_lookup_values
    WHERE view_application_id = 200) QRSLT WHERE (lookup_type=:1 AND ( UPPER(MEANING) like :2 AND (MEANING like :3 OR MEANING like :4 OR MEANING like :5 OR MEANING like :6)))
    Thanks
    Mateti

  • Using bind variables (in & out) with dynamic sql

    I got a table that holds pl/sql code snippets to do validations on a set of data. what the code basically does is receiving a ID and returning a number of errors found.
    To execute the code I use dynamic sql with two bind variables.
    When the codes consists of a simpel query, it works like a charm, for example with this code:
    BEGIN
       SELECT COUNT (1)
       INTO :1
       FROM articles atl
       WHERE ATL.CSE_ID = :2 AND cgp_id IS NULL;
    END;however when I get to some more complex validations that need to do calculations or execute multiple queries, I'm running into trouble.
    I've boiled the problem down into this:
    DECLARE
       counter   NUMBER;
       my_id     NUMBER := 61;
    BEGIN
       EXECUTE IMMEDIATE ('
          declare
             some_var number;
          begin
          select 1 into some_var from dual
          where :2 = 61;
          :1 := :2;
          end;
          USING OUT counter, IN my_id;
       DBMS_OUTPUT.put_line (counter || '-' || my_id);
    END;this code doesn't really make any sense, but it's just to show you what the problem is. When I execute this code, I get the error
    ORA-6537 OUT bind variable bound to an IN position
    The error doesn't seem to make sense, :2 is the only IN bind variable, and it's only used in a where clause.
    As soon as I remove that where clause , the code will work again (giving me 61-61, in case you liked to know).
    Any idea whats going wrong? Am I just using the bind variables in a way you're not supposed to use them?
    I'm using Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit

    Correction. With execute immediate binding is by position, but binds do not need to be repeated. So my statement above is incorrect..
    You need to bind it once only - but bind by position. And the bind must match how the bind variable is used.
    If the bind variable never assigns a value in the code, bind as IN.
    If the bind variable assigns a value in the code, bind as OUT.
    If the bind variable assigns a value and is used a variable in any other statement in the code, bind as IN OUT.
    E.g.
    SQL> create or replace procedure FooProc is
      2          cnt     number;
      3          id      number := 61;
      4  begin
      5          execute immediate
      6  'declare
      7          n       number;
      8  begin
      9          select
    10                  1 into n
    11          from dual
    12          where :var1 = 61;       --// var1 is used as IN
    13 
    14          :var2 := n * :var1;     --// var2 is used as OUT and var1 as IN
    15          :var2 := -1 * :var2;    --// var2 is used as OUT and IN
    16  end;
    17  '
    18          using
    19                  in out id, in out cnt;  --// must reflect usage above
    20 
    21          DBMS_OUTPUT.put_line ( 'cnt='||cnt || ' id=' || id);
    22  end;
    23  /
    Procedure created.
    SQL>
    SQL> exec FooProc
    cnt=-61 id=61
    PL/SQL procedure successfully completed.
    SQL>

Maybe you are looking for

  • Unable to Capture ALV output in an Internal Table, after CALL TRANSACTION

    Dear all, My requirement is to run multiple materials in T-code CK86_99 but as we know CK86_99 is only adequate to one material at a time. So, I want to capture the Output of the T-code in my Internal table with respect to all the Material Numbers I

  • Itunes 7 will not install due to DEP (data execution prevention)

    I am trying to install itunes 7 on a windows XP computer. It crashes each time I try to install immediately after clicking continue on the screen where it has 3 checkboxes (first puts icon on desktop, the second makes itunes the default audio player)

  • Access rejected; Unable to locate authentication rule

    Does anyone ever post in here just to say "Hi! I'm not having a problem - everything's running just GREAT!"? Nah, I didn't think so. <grovel> Volunteer sysops are the greatest, and I appreciate the unpaid time you put into helping us poor slobs out.

  • Report Designer - Formatting in paper layout

    Hello, I have been struggling with a request to develop a very detailed report in printed (paper Layout) format. I am OK with the data output, but spending too much time trying to get the graphical formatting to an acceptable level. Does anyone have

  • Merge to HDR Pro not saving.

    I've been using PS for the past few years now, and moved onto CS5 last year. I recently decided to try out HDR photography after realising that there was an automerge. CS5 runs fine on my laptop (Windows Vista, 32 Bit) but when I use Merge to HDR Pro