Error with Bind Variable for dblink

Good morning,
I am attempting to implement some code in a pre-page process but having problems with it. I need to query a value from the database using a dblink that points at a different database depending upon the session. I have tried the following two approaches...
SELECT COALESCE(Attribute20,'PENDING')
INTO str_Import_Status
FROM GL_JE_LINES@&P0_INSTANCE.
WHERE JE_HEADER_ID = :P430_JE_HEADER
AND JE_LINE_NUM = :P430_JE_LINE;
as well as...
str_SQL_Statement := 'SELECT COALESCE(Attribute20,''PENDING'') '||
'INTO str_Import_Status '||
'FROM GL_JE_LINES@'||:P0_INSTANCE||' '||
'WHERE JE_HEADER_ID = '||:P430_JE_HEADER||' '||
'AND JE_LINE_NUM = '||:P430_JE_LINE||';';
EXECUTE IMMEDIATE str_SQL_Statement;
I am boggled because I completely expected the first approach to work. I have a similar statement in a post submit process which works fine. That statement is...
SELECT COUNT(*)
INTO num_Collector_Count
FROM XXMC_GL_TSG2FIMS_CROSSREF@&P0_INSTANCE.
WHERE Collector_Code = :P915_Collector_Code;
Any help or pointers on this would be greatly appreciated.
--Adam Cumming                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Never mind....
After I posted this I realized I had a bad variable name. Syntax error

Similar Messages

  • Ora-01008 error with bind variable

    Hi,
    We have a test program which have one bind variable on a column which is varchar2(20), in the test program we've passed a 20 character string to the variable. The program returns error in one of the databases but all others are successful. We've checked the column is same in all of them.
    Exception in thread "main" java.sql.SQLException: ORA-00604: error occurred at recursive SQL level 1
    ORA-01008: not all variables bound
    Could you please advise how to troubleshoot this issue?
    Regards

    We aren't going to be able to help you if you won't post the database code that is giving the error.
    And now we need the Java code that is constructing the query that you are using.
    Your error is saying there is a second variable that you are not providing a value for.
    And you said
    >
    We have a test program which have one bind variable on a column which is varchar2(20), in the test program we've passed a 20 character string to the variable.
    >
    But you are using a string that is 23 characters long
    "a3g34-b13fd-efaie-f83fk"How does 23 go into 20?

  • How to use ApplicationModuleImpl.createViewObject for VO with bind variable

    I need to implement a AM method to create VO instance from a generic VODef with bind variables.
    The createViewObject() will trigger the executeQuery of the VO before I can set up the bind variables for the query.
    What is the proper way to create view object instance with bind variables?

    I am using JDeveloper 11.1.1.2.
    I have a ViewObjectA declared with some bind variables which determine what business data to be retrieved at runtime via a service method of the ApplicationModule.
    As the ViewObjectA is only referenced internally within ApplicationModule and I need more than one instance of the ViewObjectA for different conditions at runtime,
    I use ApplicationModuleImpl.createViewObject() to create an instance of ViewObjectA instead of adding ViewObjectA to the data model of the ApplicationModule.
    Currently, when the ViewObjectA is instantiated, it also trigger an executeQuery() which will not retrieve correct data until I set up the bind variables.
    However, the createViewObject() method doesn't let me pass in the values of the binding variables.
    Currenlty, I just call the createViewObject() and then set the binding variables values and call executeQuery() again.
    Just checking if there is a better way to do so...

  • View link accessor for master view object with bind variables

    Is there a way to set bind variables for a view object to which a view link accessor is used to retrieve a view row from a detail view row in a master-detail relationship ?
    I understand that RowSet (or Row) returned by a view link accessor originates from an "internally created" view object instance.
    I am using 10.1.3.0.4 JDeveloper.

    Thanks! that's right the bind variables when i use it on where clause must be required, so i change my sql to:
    Select /*+ use_nl(p p2) */
    'F' tipo_persona,
    p.ID_PERSONA, p.TDOC, p.NDOC, p.DENO
    From SINT_PERSONA p,
    ( Select /*+ index(a SINT_PERSONA_IX2) */
    a.ID_PERSONA
    From SINT_PERSONA_DOCUMENTO a
    where ( NDOC = :p_cuit
    and :p_cuit <> 0 )
    ) p2
    Where p.id_persona = p2.id_persona
    AND (deno = decode(:p_deno,'null',null,upper(:p_deno)) or
    :p_deno = 'null')
    AND (NDOC = decode(:p_ndoc,0,null,:p_ndoc) or
    :p_ndoc = 0)
    and grado_confiab > 0
    and my bind variables:
    p_ndoc required default value 0
    p_cuit required default value 0
    p_deno required default value null
    and works ok!
    thanks a lot !!!!

  • LOV(af:selectOneChoice) with bind variable in af:table

    Hi All,
    I have a table where a column is defined as dropdown(af:selectOneChoice). The query for selectOneChoice has a bind variable which needs to be set as a value from the base view Object corresponding row.
    Suppose a table Employee
    EmpId EmpName EmpType Authorization
    101 John Temp No
    The above table is created as af:table and 'Authorization' is implemented as dropdown(af:selectOneChoice) . The selectOneChoice has a query(AuthorizationLovVVO) with bind variable . For each row of af:table(EmployeeVO) , af:selectOneChoice query(AuthorizationLovVVO) requires
    the corresponding row(EmployeeVO) 'EmpType' to be set as value of bind variable.
    Can you please suggest how can we achieve this functionality.
    Edited by: 907302 on Oct 17, 2012 7:22 AM
    Edited by: 907302 on Oct 17, 2012 7:22 AM

    I have checked the following post where it has been suggested to access the the current row value as groovy expression.
    groovy for bind variable
    Suppose my AM name is 'TestAM' , i have tried the below expressions for value of bind variable but it does not work :
    1) adf.object.TestAM.findViewObject('EmployeeVO1').currentRow.EmpType
    2) adf.object.TestAMDataControl.findViewObject('EmployeeVO1').currentRow.EmpType
    None of the above expressions work and i get the error while running the page as 'Variable NotesAM is not recognized.' / 'Variable NotesAMDataControl is not recognized.' .
    Can you please suggest if we can achieve the functionality using this approach . Also let me know if i am missing something in the above expression.

  • ADF Groovy Expression with bind variable and ResourceBundle

    Now I have ViewObject which have WHERE clause with bind variable.
    This bind variable is for language. Within bind variable I can change Value Type to Expression and into Value: I put +(ResourceBundle.getBundle("model.ModelBundle")).getString("language")+.
    Now if I run Oracle Business Component Browser (on AppModule) this works. In my ModelBundle.properties there is language=1 name-value pair. And with different locale I have different language number.
    Now if I put that ViewObject on one JSF, this bind variable expression does not work any more. Error:
    *oracle.jbo.JboException: JBO-29000: Unexpected exception caught: java.util.MissingResourceException, msg=Can't find bundle for base name model.ModelBundle, locale my_locale*
    Any ideas?
    10x
    Zmeda

    The most wierd thing is that, if I make ViewObjectImpl and insert this method
    public String getLanguage() {
    return (ResourceBundle.getBundle("model.ModelBundle")).getString("language");
    and call it in Bind Variable Expression Value: viewObject.getLanguage()
    IT WORKS!
    But why with groovy expression it does not work?
    Zmeda

  • Where clause with Bind Variable in ViewObject

    As per recomendations from Jdev team they say that using Bind varialbles in where clause will improve the performance (Option 1) But it is causing us to create more view objects.
    Example : Lets say we have a View Object EmpVO
    Option 1:
    ViewObject vo=context.getViewObject("EmpVO");
    vo.setWhereClause("EMPNO=?");
    vo.setWhereClauseParam(0,st);
    (or)
    Option 2:
    vo.setWhereClause("EMPNO="+st);
    If we want to use same View Object "EmpVO" in another Action Class
    ViewObject vo1=context.getViewObject("EmpVO");
    vo1.setWhereClause("DEPTNO=?");
    vo1.setWhereClauseParam(0,str);
    It this case it throws an error saying BIND VARIABLE already exits. So we have to make another View Object.
    Where as if we did not use bind variable but used Option 2 approach the same view object can be used in multiple pages.(at the expense of performance as per Jdev team)
    Are we doing something wrong here or are there other ways to use the same view object when using bind variable in where clause.
    Thanks

    I haven't been using BC4J for a while, but I seem to recall that the recommendations are that you don't set the where clause at runtime: You're supposed to define your view with the bind parameter already in it.
    So you'd probably define an EmpsForEmpNoVO and type "EMPNO = ?" in the where box. (There are other ways of finding a single row/entity and one of those may well be more efficient. Perhaps a better example of where you might want a view of employees is WHERE DEPTNO = ?.)
    IIRC, all instances of a particular type of view share the same definition, so you have to be careful if you alter that at runtime. However, I think everything's set up so that you can have many different (and separate) resultsets for a single view (instance) - meaning that it's possible to "run" a view for (e.g.) two different ids. (It's definitely possible to create two different instances of a view from its definition - and the resultsets will definitely be separate then. I think there's a "create" method on the application module; I remember that "find..." always returns the same instance of the view.)
    Hope that's a push in the right direction (since no-one else had replied - and I hope not too much has changed since 9.0.3)....
    Mike.

  • BC4J bug with "bind variables" JBO-27122 ORA-01008

    I think we are found a BUG using BC4J with bind variables in a view object.
    If the bind variable appear in the WHERE condition two or more times at
    the beginning of the query the above error occur.
    oracle.jbo.SQLStmtException: JBO-27122: SQL error during statement preparation. Statement:
    SELECT Emp.EMPNO,Emp.ENAME,Emp.JOB,Emp.MGR,Emp.HIREDATE,Emp.SAL,Emp.COMM, Emp.DEPTNO
    FROM SCOTT.EMP Emp
    WHERE :1 <=10000 and :1 <= sal and :2=20
    java.sql.SQLException: ORA-01008: not all variables bound
    Otherwise if bind variable apper two or more times, but not together
    like this sample:
    WHERE :1 <=10000 and :2=20 and :1 <= sal
    the error not occur.
    We prove this with:
    JDeveloper 9.0.5.2 (build 1618)Business Components Version 9.0.5.16.0
    JDeveloper 9.0.5.0 (build 1375)Business Components Version 9.0.5.13.52
    I looking for a patch! or acceptable workaround.
    Tx for your help!
    diego.
    /* the cliente app */
    ApplicationModule am = Configuration.createRootApplicationModule("business_tier.AppModule","AppModuleLocal");
    ViewObject vo = am.findViewObject("EmpView");
    vo.setWhereClauseParam(0,"100");
    vo.setWhereClauseParam(1,"20");
    Row emp = vo.first();

    This is a known bug (1326006). The workaround is to use:
    vo.setWhereClauseParam(0,"100");
    vo.setWhereClauseParam(1,"20");
    vo.setWhereClauseParam(2,"20");
    Hope this helps,
    Lynn
    Java Tools Team

  • Parameter error - bad bind variable in a Package..!!

    Hello All
    i am tring to create a security package with in one procedure i am trying to handle the number of times the user enters the wrong user name or password:
    -i created a parameter on my login form and add it to my procedure and it works just fine,But when i tried to copy the same procedure the package inside my library can't recognize that Parameter.
    -It gives me error : bad bind variable.
    The code is as follows.
    PARAMETER.COUNT := :PARAMETER.COUNT + 1;
    IF :PARAMETER.COUNT > 3 THEN
    WRONG_ALERT('WRONG_PASS',' ur number of trials has expiered the form will be closed ');
    EXIT_FORM;
    END IF;
    Can anyboady help me pls.
    Regards,
    Abdetu.

    Super,It works Just fine.
    Thanks Gerd,
    That's make me decide that if i have the following statatment for example:
    IF :USER_CODE IS NULL THEN .........
    I have to change it to :
    IF copy (name_in ('USER_CODE' )) IS NULL THEN..........
    But,if i have the following select statment :
    ==============================
         SELECT USER_CODE , USER_PASS WORD
         INTO :GLOBAL.USER_CODE , :GLOBAL.USER_PASS WORD
         FROM APP_USERS
         WHERE USER_CODE = :USER_CODE
         AND USER_PASS WORD= :USER_PASS WORD;
    Should i transfer it to the following:
    =========================
    SELECT USER_CODE , USER_PASS WORD
    INTO     COPY(NAME_IN ('GLOBAL.usr_code'), COPY(NAME_IN ('GLOBAL.PASSWORD')
    FROM APP_USERS
         WHERE USER_CODE = COPY(NAME_IN ('USER_CODE' )
    AND USER_PASS WORD=COPY(NAME_IN ('USER_PASS WORD');
    Pls help me,it's my first time ...
    Thanks in advance.
    Regards,
    Abdetu.

  • Image Item - Error: bad bind variable

    Hi All,
    I select a Image field from a table and set it to a Image Item in a form 10g. But I have error "Bad bind variable"
    Here is source code in my Post_query trigger:
    SELECT cust_sign INTO :dema_depo.dema_depo_sign
    FROM cust_sign WHERE custcod = :dema_depo.cust_sign_custcod;
    I would like to learn if you have any solution or document to solve my problem.
    Thanks very much for your help!
    BACH

    Dear Sir/Madam,
    I'm reading chapter 16: Working with Images - Oracle Forms Developer's Guide and found that cannot write a SELECT statement to select a a LONG RAW value INTO an image item.
    Thus, any the other way to fetch fr a DB LONG RAW value INTO an image item ???
    Many thanks!
    BACH

  • Stored Procedure with bind variables

    Hello,
    I have problems when executing this sample code:
    Procedure Test (..., in_Param IN CHAR, ...)
    Query_Str := 'Select * from Table1 where column1 IN :in_Param';
    Open Cursor1 For Query_Str Using in_Param;
    This Cursor retuns rows when in_Param is 'A'
    This Cursor does not return any row if in_Param is ('A', 'B')
    Can you please help to track the error in this Query?
    Many thanks

    It seems to be that the bind variable is treated as a single discrete object. Hence
    'Select * from Table1 where column1 IN :in_Param';
    is functionally the same as
    'Select * from Table1 where column1 = :in_Param';
    so when in_Param is ('A', 'B'), what actually gets executed is
    Select * from Table1 where column1 = 'A, B';
    Not surprisingly this returns no rows.
    You can of course do this:
    'Select * from Table1 where column1 in( :x, :y, :z)';
    Open Cursor1 For Query_Str Using :i, :j, :k;
    So you could parse in_param yourself, populating the unused variables with nulls, so that if in_param = ('A, B') then i=A, j=B and k=null. Given that in 8i an IN string can have 1000 variables this could be a right mare if you don't put a cap on in_param.
    Your alternative is not to use a bind variable for this statement.
    rgds, APC

  • ODT Query Window. Query with binding variable?

    I have the ODT 11.1.0.7.20 installed.
    In "Query Window", I execute an SQL with binding variables. But I only get ORA-01008 errors. How do I do that?
    I want to double click an SQL and load it in "Query Window". How do I do that?
    I want to right click an SQL and select "Open with Query Window". How do I do that?
    In Query Window I want to load an SQL either by drag and drop or by select a function "Open SQL". How do I do that?
    Why none of these functionalities work as you could expect?
    Thanks,
    Tobias

    Finally i found the problem..
    The problem was that i had to remove one line from the properties of my table departments, the property: selectedrowkeys, because it only passed the last selected row.
    Still, i apreciate the help and i had to replace some code in the bean.java , because of the exception error and you didn't had to do that. Maybe i did some configuration in the wrong way and it went wrong.
    Thanks for the help.
    Regards,
    Frederico.

  • RESTful service and BLOB with bind variable

    Hi,
    Has anyone successfully created a RESTful service with bind variable to retrieve a BLOB field and render it in an Apex app? I can create RESTful web service and render BLOB field for a record with no bind variable (single row). As soon as I add bind variable my RESTful service fails -- I get 404 Error. Without bind variable it renders both in TEST tool of Workspace and direct URL. As soon as I add a bind variable it fails either way. I have reported this in an SR to Oracle support, but thought I would post here too.
    I would also like to retrieve the photo into an Apex application. Any hints would be appreciated.
    Thanks,
    Pat

    Hi Fateh -
    Good question. You would identify the source type as a Media Resource, and use an SQL statement with the primary key and the BLOB column. When you use Media Resource, you are essentially telling your Database Cloud Service not to marshall the data, just to send it - which is exactly what you are looking for.
    With this implementation, you would have to have a separate SQL call for each BLOB retrieval. However, you might be able to use a PL/SQL block as the end point for the RESTful Service and take care of multiple BLOB processing in the block.
    Hope this helps.
    - Rick Greenwald

  • Bind variable for view accessor

    I am using a Gantt chart where I need to pass in a date field for the schedule as a bind variable.
    Since this is a Gantt chart, there is no iterator binding for the child VO (the tasks) in my page definition.
        <gantt IterBinding="ParentVO1Iterator" id="ParentsVO1" xmlns="http://xmlns.oracle.com/adfm/dvt">
          <ganttDataMap>
            <nodeDefinition DefName="com.pat.model.view.ParentsVO" type="Resources">
              <AttrNames>
                <Item Value="ParentId" type="resourceId"/>
              </AttrNames>
              <Accessors>
                <Item Value="MainGantt" type="tasks"/>
              </Accessors>
            </nodeDefinition>
            <nodeDefinition type="Tasks" DefName="com.pat.model.view.MainGantt">
              <AttrNames>
                <Item Value="PatId" type="taskId"/>
                <Item Value="StartTimeDate" type="startTime"/>
                <Item Value="EndTimeDate" type="endTime"/>
                <Item Value="Patname" type="label"/>
              </AttrNames>
            </nodeDefinition>
    I have tried retrieving the accessor through the parent VO, and setting the bind variable.
    But I get an error if I fire executeQuery() on the child VO that says that the bind variable for the view link is missing.
            DCIteratorBinding iter = dcBindings.findIteratorBinding("ParentVO1Iterator"); // get parent iterator binding
            ViewObject vo = iter.getViewObject();
            MainGanttImpl childVO = (MainGanttImpl)vo.findAttributeDef("MainGantt").getAccessorVO(vo); //get the child VO through the accessor link
            childVO.setpViewDate(new Timestamp(((Date)getGanttDate().getValue()).getTime())); // get the date entered by the user and set to the child VO
            childVO.executeQuery(); //execute the child VO
    Exposing the child VO impl through the Application module and setting the bind variable to that instance alone has no impact on the Gantt data returned.

    We researched a bit more and hit upon the solution here.
    Decompiling ADF Binaries: Search by child attributes on a tree table
    I added the same bind variable to my parent VO (and added some SQL 'and : pViewDate = : pViewDate' to the query to just get it to work )
    In the parent VO Impl class, I overrode the createViewLinkAccessorRS method:
       protected ViewRowSetImpl createViewLinkAccessorRS(AssociationDefImpl assocDef,
                                                          ViewObjectImpl accessorVO,
                                                          Row masterRow,
                                                          Object[] values) {
                ViewRowSetImpl v =
                super.createViewLinkAccessorRS(assocDef, accessorVO, masterRow,
                                               values);
          //  Timestamp viewDate = (Timestamp )accessorVO.getNamedWhereClauseParam("pViewDate");
            v.setNamedWhereClauseParam("pViewDate", getpViewDate());
            return v;                                                    
      public Timestamp getpViewDate() {
            return (Timestamp) getNamedWhereClauseParam("pViewDate");
    This sets the child VO with the value of the bind variable that I have set to my parent VO. This got the Gantt working!

  • Create collection from query with bind variable

    Apex 4.0.2
    Per Joel Re: Collection with bind variable the apex_collection.create_collection_from_query_b supports queries containing bind variable references (:P1_X) but I am not sure how to use this feature, the documentation doesn't have an example, just the API signature for the overloaded version has changed.
    If the query contains 2 bind variable references to session state (:P1_X and :P1_Y), can someone please show an example of what to pass in for the p_names and p_values parameters to the API?
    Thanks
    procedure create_collection_from_query_b(
        -- Create a named collection from the supplied query using bulk operations.  The query will
        -- be parsed as the application owner.  If a collection exists with the same name for the current
        -- user in the same session for the current Flow ID, an application error will be raised.
        -- This procedure uses bulk dynamic SQL to perform the fetch and insert operations into the named
        -- collection.  Two limitations are imposed by this procedure:
        --   1) The MD5 checksum for the member data will not be computed
        --   2) No column value in query p_query can exceed 2,000 bytes
        -- Arguments:
        --     p_collection_name   =  Name of collection.  Maximum length can be
        --                            255 bytes.  Note that collection_names are case-insensitive,
        --                            as the collection name will be converted to upper case
        --     p_query             =  Query to be executed which will populate the members of the
        --                            collection.  If p_query is numeric, it is assumed to be
        --                            a DBMS_SQL cursor.
        -- example(s):
        --     l_query := 'select make, model, caliber from firearms';
        --     apex_collection.create_collection_from_query_b( p_collection_name => 'Firearm', p_query => l_query );
        p_collection_name in varchar2,
        p_query           in varchar2,
        p_names           in wwv_flow_global.vc_arr2,
        p_values          in wwv_flow_global.vc_arr2,
        p_max_row_count   in number default null)
        ;

    VANJ wrote:
    Apex 4.0.2
    Per Joel Re: Collection with bind variable the apex_collection.create_collection_from_query_b supports queries containing bind variable references (:P1_X) but I am not sure how to use this feature, the documentation doesn't have an example, just the API signature for the overloaded version has changed.
    If the query contains 2 bind variable references to session state (:P1_X and :P1_Y), can someone please show an example of what to pass in for the p_names and p_values parameters to the API?Not tried it, but guessing something like
    apex_collection.create_collection_from_query_b(
        p_collection_name => 'foobar'
      , p_query => 'select f.foo_id, b.bar_id, b.baz from foo f, bar b where f.foo_id = b.foo_id and f.x = to_number(:p1_x) and b.y = :p1_y'
      , p_names => apex_util.string_to_table('p1_x:p1_y')
      , p_values => apex_util.string_to_table(v('p1_x') || ':' || v('p1_y')))

Maybe you are looking for

  • Convert V1-681 message from information to error (free goods)

    Dear SD Gurus We want to give free goods 1 for every 10 sets.  The free goods fuctionality is configured and is working fine. But the free goods quantity in sales order is open for change. Some user may misuse this functionality. How to control the u

  • JDO Auto Generate Primary Key

    Hi I am working with JDO. I want to auto generate the primary key value that should increment for each entry into database. How can i do it, please guide me. Any link or doc will be appreciated. Regards Osman

  • Bind a front panel control to an item

    Hi all, I have a problem with selecting DataSocket in "Data Binding Selection" when I want to bind a front panel control to an item in another server such as an OPC Server. I want to know whether we connect to that item via OPC Server or DataSocket S

  • Converting from decimal to binary to hexadecimal to octal

    hello everyone, my question is, Is there a way to get decimal input from user and print the binary, hexadecimal and octal value of that decimal? just like C does in printf command

  • Install error, failed to initialize

    Can not install Flash Player.  When I run the installer from the link on the main page I get an error that states "failed to initialize".  I have tried downloading and installing the 'offline' installer and it seems to run, but the program is not act