Passing SessionBean variable to sql query editor

Hi,
I am trying to pass a variable that I define locally in SessionBean to sql query via the query editor.
SELECT ALL comments.id,
                    comments.comment,
                    comments.comment_date
FROM comments
WHERE comments.id = **SessionBean1.id**How do I specify **SessionBean1.id** in the WHERE clause?
Thanks for your help.
--izumi                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Use this SQL query:
SELECT ALL comments.id,
                    comments.comment,
                    comments.comment_date
FROM comments
WHERE comments.id = ?Then in the page that uses this (wherever the query is executed) provide the variable value with:
<your row set name>.setObject(1, getSessionBean1().getCommentId());

Similar Messages

  • Passing values in a vector list as bind variables in sql query.

    Hi,
    I have a vector list containing values 12,13,14.
    vector<string> v;
    v has values 12,13 and 14.
    Here the number of values in vector list are not fixed.
    I want to pass these values as bind variables to sql query.
    Can anyone suggest me how to do this.
    Thanks in advance!!

    Ah, the it's the classic 'Varying In-List' again
    See:
    The Tom Kyte Blog: Varying in lists...
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:110612348061 (started more than a decade ago, so scroll down for more recent examples)

  • SQL Query editor misbehaving

    SQL query builder does not allow LIKE criteria for selecting
    data, as in:
    SELECT ALL ROOT.PERSON.PERSONID,
                             ROOT.PERSON.JOBTITLE,
                             ROOT.PERSON.FREQUENTFLYER,
                             ROOT.PERSON.NAME
        FROM ROOT.PERSON
    WHERE PERSON.NAME LIKE ? ;I tried editing the JAVA code for my web form directly:
               personRowSet.setCommand("SELECT ALL ROOT.PERSON.PERSONID, ROOT.PERSON.JOBTITLE,
    ROOT.PERSON.FREQUENTFLYER, ROOT.PERSON.NAME
    \nFROM ROOT.PERSON\nWHERE PERSON.NAME LIKE ?");
    but as soon as I click on the SQL Query editor, eg. to add an output column, an error window pops up, and in the JAVA
    code the 'LIKE' statement becomes '='.
    I tried typing the 'LIKE' criteria in the SQL source code window,
    but I get the same behaviour: the JAVA source gets updated, but
    as soon as I return to the SQL Query editor, the error window
    pops up and the 'LIKE' statement is replaced by '='.
    Otherwise I found the way the IDE handles data table
    component binding to database data rather elegant.
    lovely work, guys!

    Nice to know that, thanks for the feedback.
    Please consider the "LIKE" operator a very powerful and useful SQL keyword, by means of which you can incorporate all kinds of expressions in order to build a comparison that is much like regular expressions.
    Whoever used the LIKE operator to select stuff is probably never give it away because it is so powerful and programmable with variables and all sorts of constructs - you can practically go after any "text" field with it and get it your way.
    I personally would rather have the EQUAL operator handle regular expressions directly - but I found LIKE easier and more viable to handle programmatically using variables/field contents as part of the search arguments. This ia also a limitation of SQL Server, Access, etc. - but you can't say that they didn't provide you with a suitable ersatz.
    So I guess supporting LIKE makes sense for Studio Creator...

  • SQL Query Editor Hangs Completely!

    Hi,
    I am working on Dell Precision 360,Windows XP with 512MB RAM.
    Problem is Studio creator works almost well with the 512MB RAM(esp. by increasing the process priority),
    but whenever I open the SQL Query Editor to edit a query it hangs completely.
    I don't think it hangs due to memory shoratge problem.
    what could be the reason or is their some other alternative ,coz whenever it hangs i have to manually kill the process due to which sometime some files get corrupted.

    Hi,
    The system requirements for Creator 2 can be found at:
    ttp://developers.sun.com/prodtech/javatools/jscreator/features/sysreqs/index.html
    As can be seen 1 GB RAM is required. At 512 MB the performance will be affected.
    Cheers
    Giri

  • Sql Query Editor hangs

    Hi after attaching a table component in a jsp.....and the selecting the table from the datasource...... the Sql Query editor hangs when trying to click on the table-nameRowset entry in the outline..
    could anybody tell me what might be wrong

    Hi,
    The system requirements for Creator 2 can be found at:
    ttp://developers.sun.com/prodtech/javatools/jscreator/features/sysreqs/index.html
    As can be seen 1 GB RAM is required. At 512 MB the performance will be affected.
    Cheers
    Giri

  • Bind variables in SQL query of DBAdapter

    Hi,
    Can we add bind variables to SQL query when we define DB adapter...?

    No, not in the Wizard.
    I do not know if it is possible with the TopLink in combination with BPEL.
    But can you use a Pl/SQL procudere/package that performs the dynamic SQL?

  • How to pass a result of SQL query to shell script variable

    Hi all,
    I am trying to pass the result of a simple SQL query that only returns a single row into the shell script variable ( This particular SQL is being executed from inside the same shell script).
    I want to use this value of the variable again in the same shell scirpt by opening another SQL plus session.
    I just want to have some values before hand so that I dont have to do multiple joins in the actual SQL to process data.

    Here an example :
    SQL> select empno,ename,deptno from emp;
         EMPNO ENAME          DEPTNO
          7369 SMITH              20
          7499 ALLEN              30
          7521 WARD               30
          7566 JONES              20
          7654 MARTIN             30
          7698 BLAKE              30
          7782 CLARK              10
          7788 SCOTT              20
          7839 KING               10
          7844 TURNER             30
          7876 ADAMS              20
          7900 JAMES              30
          7902 FORD               20
          7934 MILLER             10
    14 rows selected.
    SQL> select * from dept;
        DEPTNO DNAME          LOC
            10 ACCOUNTING     NEW YORK
            20 RESEARCH       DALLAS
            30 SALES          CHICAGO
            40 OPERATIONS     BOSTON
    SQL> exit
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    $ cat my_shell.sh
    ### First query #####
    ENAME_DEPTNO=`sqlplus -s scott/tiger << EOF
    set pages 0
    select ename,deptno from emp where empno=$1;
    exit
    EOF`
    ENAME=`echo $ENAME_DEPTNO | awk '{print $1}'`
    DEPTNO=`echo $ENAME_DEPTNO | awk '{print $2}'`
    echo "Ename         = "$ENAME
    echo "Dept          = "$DEPTNO
    ### Second query #####
    DNAME_LOC=`sqlplus -s scott/tiger << EOF
    set pages 0
    select dname,loc from dept where deptno=$DEPTNO;
    exit
    EOF`
    DNAME=`echo $DNAME_LOC | awk '{print $1}'`
    LOC=`echo $DNAME_LOC | awk '{print $2}'`
    echo "Dept Name     = "$DNAME
    echo "Dept Location = "$LOC
    $ ./my_shell.sh 7902
    Ename         = FORD
    Dept          = 20
    Dept Name     = RESEARCH
    Dept Location = DALLAS
    $                                                                           

  • Passing variables to SQL query from checkboxes

    Hello,
    I have a cursor which gets different ids from an id table. The cursor is something like this:
    CURSOR id IS
             SELECT distinct id_ FROM I
                      order by id_;I then iterated through the cursor to made checkboxes to choose multiple ids:
    FOR i IN id
           LOOP
            htp.p('<tr>
           <DIV align="left"><td><input type="checkbox" name="option" value=ID '||i.id_||'> </td></tr>');
             htp.p('<font size="'||3||'">'
             ID'||i.id_||'</a></font>'
             ||'</a>' );
           htp.br;                       
           END LOOP;The values of the checkboxes were extracted by:
    var ids ="";
    for (var j = 0;j < document.form.option.length; j++)
                 if (document.form.option[j].checked)
                     ids = ids + document.lf.option1[j].value + "\n";
            }I have the following SQL query:
    Select * from Persons where Identification = ...; I would like to use to pass the values of the checkboxes (i.e. the variable ids ) to my SQL query. I want the user to select multiple values for the checkboxes. For example, they can select 4 and 3. I want to pass the difference to my SQL query....that is, I want the id to be 1. So, I want this:
    Select * from Persons where Identification = 1; Any ideas how to do this? Also my code above is in different procedures within a single package.

    Your requirement is not very clear. What happens when you select 3 checkboxes? What will be the difference between them? How do you pass that information to the oracle report?

  • Passing Session State Variables to SQL query

    Hi,
    I am using 3 pages in my application build by APEX 3.1.2. Login Page, Report Page and Form Page.
    I am using LDAP authentication for Login Page and I want the user session information to be feeded to the filter query
    being used to display data on Report Page. Is there any way to do that. I know
    there is one variable %LDAP_USER% which is using the userid given on login
    page. But I dont know how to use APEX session variables to filter query. Need
    assistance on that stuff.
    Thanks,
    Gaurav

    Hi Gaurav,
    Session "variables" (global items, application items and page items) can be accessed using v('ITEM_NAME') (for strings) or nv('ITEM_NAME') (for numbers) within sql queries/procedures/triggers etc.
    If you look at the Substitution Strings section here: http://download.oracle.com/docs/cd/E10513_01/doc/appdev.310/e10499/index.htm#S you'll find more information about this and a list of items that you can use that are set by Apex itself.
    Andy

  • Passing multiple parameters in sql query

    Hi All,
    This may not be the correct place to post this.
    How to pass multiple paramters to a variable in sql developer.
    Ex: Select * from Country where state= :statename (Country is table name, state is column name)
    If I execute the above query in SQL Developer I can pass only one parameter at a time for :statename ie either KERALA,KARNATAKA,PUNJAB etc.
    How can I pass multiple values (all KERALA,KARNATAKA,PUNJAB) or ALL column values at a time in SQL Developer.
    Thanks

    user1668671 wrote:
    How to pass multiple paramters to a variable in sql developer.A scalar variable by definition cannot store more than one value at a time.
    Array type variables can, as this example using the built in type odcivarchar2list shows
    SQL> select
      2      object_name,
      3      object_type
      4  from
      5      all_objects o
      6  where
      7      o.object_name in
      8      (select column_value from
      9      table(sys.odcivarchar2list('DUAL','ALL_OBJECTS')));
    OBJECT_NAME                    OBJECT_TYPE
    DUAL                           TABLE
    DUAL                           SYNONYM
    ALL_OBJECTS                    VIEW
    ALL_OBJECTS                    SYNONYM
    ALL_OBJECTS                    VIEWHere is a full discussion with multiple solutions for various versions including a string parsing
    http://tkyte.blogspot.com/2006/06/varying-in-lists.html
    Does SQL Developer support array type variable? I don't know they may know here {forum:id=260}
    Otherwise the link above shows how to parse a single character variable into multiple values that will be needed.

  • Variable in sql task editor

    I have below sql statements in sql task editor. I do not want to keep in variables as a parameters. I want everything to be done in sql task only....
    if (select id from tablename where id=1)
    beging
    exec stored procedure
    end
    Error output - [execute sql task] error: executing the query " if (select id from tabl..." failed with the following error: "An expression of non-boolean type sepecified in a context where a condition is expected, near 'being'.".Possible
    failure reasons: problems with the query, "Resultset" property not set correctly, parameters not set correctly, or connection not established correctly.

    I have below sql statements in sql task editor. I do not want to keep in variables as a parameters. I want everything to be done in sql task only....
    if (select id from tablename where id=1)
    beging
    exec stored procedure
    end
    Error output - [execute sql task] error: executing the query " if (select id from tabl..." failed with the following error: "An expression of non-boolean type sepecified in a context where a condition is expected, near 'being'.".Possible failure reasons:
    problems with the query, "Resultset" property not set correctly, parameters not set correctly, or connection not established correctly.
    Hi ,
    Check the syntax of the query , run it on SSMS and test it properly and then use the same inside 
    Execute SQL Task .
    sathya - www.allaboutmssql.com ** Mark as answered if my post solved your problem and Vote as helpful if my post was useful **.

  • Passing parameter to a SQL query - Please help

    Hi All,
    I am new to JDBC. I have been trying to pass an external variable to an SQL Query.
    The query is
    String username1="le";
    PreparedStatement pstmt = null;
    pstmt = c.prepareStatement("select * from users where USER_NAME like '%?%'");
         pstmt.setString(1, username1);
         pstmt.executeQuery();
         ResultSet rs = pstmt.getResultSet();
    I am trying to retrieve values from the users table where the USER_NAME column value that is a String contains the supplied value username1.
    I am using the question mark (?) character to pass the value from the variable username1. I am also using the '%' substitution character which matches for any number of characters. So, the above query should retrieve rows where the USER_NAME is something like "charles","leander","Elena" etc.( that contains "le")
    I am getting the error:
    SQLException: java.sql.SQLException: ORA-01006: bind variable does not exist
    I changed the query to
    PreparedStatement pstmt = null;
    pstmt = c.prepareStatement("select * from users where USER_NAME like '% " + username1 + "%'");
         //pstmt.setString(1, username1);
         pstmt.executeQuery();
    This time , it is not giving the error and retrieving properly.
    But I want to use the original query and use the "pstmt.setString(1, username1); " . Is there any way of achieving this?
    Please help.
    Cheers,
    charles_am

    hi,
    try this...
    String username1="%le%";
    pstmt = c.prepareStatement("select * from users where USER_NAME like ?")
    pstmt.setString(1,username1);
    cheers,
    rpk

  • IF NEW VARIABLE IN SQL QUERY, DISPLAYS AS LAST COLUMN + rpad not working

    Hello everybody and thank you in advance,
    1) if I add a new variable to my sql query to select a column which was already in the table, it shows it in the report table as the Last column to the right. That is, if I add "street" to
    something like city, postcode, street, store, manager, etc, instead of placing street between postcode and store, it places it as i said as the last column to the right.
    2) When values are entered into the cells of the tables, yes, they do expand it to their needed lenght, But, only if it is one word. If it is two, like when i enter the value "very good"
    then it takes two lines so as with a carriage return within the cell, thus, making it too high the row. I tried to padd spaces with rpad but it did not work. something like rpad(stock, 20,' ')
    I must say that the table is in the same page where there is a Form, so as the table grows in lenth it is actually squeezing the form located right on its left.
    3) rpad did not work with the most simple syntax, but less would with what i need because it turns out i am using DECODE in order to do a conversion between value displayed and
    value returned in my select list of values, something like : DECODE (TO_CHAR (stock),'1','Deficient','2','Average','3','Good','4','Very Good',null) AS stock,
    so, i have tried to put the rpad there in several places but either it gave parsing error or it left the column empty not picking any values.
    thank you very much
    Alvaro

    Alvaro
    1) That is standard behaviour of apex builder. You can change the display order with the arrows in the report attributes column report.
    2) You will have to play with the style attributes of the column to accomplice this. For instance style="white-space:pre;" in the Element Attributes of the column attributes. White-space:normal would thread several space (' ') as 1. So no matter how many you add with rpad they will be shown as 1.
    Or set a width either as attibute or in a style class for that column.
    Nicolette

  • Passing Global Variable in Sql Object

    Hi
    How can i pass my global variable into SQL object? I tried to pass it but then I tried to update the schema it giving me the error at varble
    Please advise me

    The Update schema is used only to get the structure for the Output.
    Once you have a valid structure and the SQL Parses without any variables use the syntax for applying variables as in any Script within DI.
    $GV_MyVar enclosed within square brackets will be replaced by Value of the variable.
    $GV_MyVar enclosed within curly brackets will be replaced by Value of the variable enclosed in single quotes.
    When the job runs, the variables will be replaced with values OR values with quotes. It is at this time, the SQL send to the database is validated for syntax.
    Therefore, you will not know the validity of your SQL with Global Variables until you run the job.
    Hope this helps!
    Thanks & Regards
    Tiji
    Edited by: Tiji Mathew on May 8, 2009 3:40 PM
    The actual syntax was being posted as a link. edited to make the text descriptive.

  • Passing Unix variable into sql

    Hi,
    I have a shell script with embedded SQL.
    In the script I have a Unix variable that has a char value
    id="P_test".
    I need to pass this variable to a select in a where condition like
    select * from table where camp1=$id.
    The problem is $id returns P_test rather than 'P_test' so that the select can work.
    Any ideea how to change the clause where to make the select work?
    I could also change the variable id as to have id=" 'P_test' " , but this variable comes from a file parsed and I don't know how to get 'P_test' instead of P_test.
    Thanks

    another option may be like this example -
    $OH10/bin/sqlplus -s > $CIGDEM_LOG_DIR/step1_$CIGDEM_DATE.log 2> $CIGDEM_LOG_DIR/step1_$CIGDEM_DATE.err <<EOF
    $CIGDEM_USERNAME1/$CIGDEM_PASSWORD1@$OTNS10
    @$CIGDEM_DIR/step1.sql $CIGDEM_EXP_DIR $CIGDEM_USERNAME3 $CIGDEM_PASSWORD3 $PERMANANT_TABLESPACE $TEMPORARY_TABLESPACE
    exit ;
    EOF
    "@$CIGDEM_DIR/step1.sql $CIGDEM_EXP_DIR $CIGDEM_USERNAME3 $CIGDEM_PASSWORD3 $PERMANANT_TABLESPACE $TEMPORARY_TABLESPACE" here we call step1.sql with arguments, they will be used with &n symbol inside sql statement -
    .. CREATE USER &2 IDENTIFIED by &3 TEMPORARY TABLESPACE &5 DEFAULT TABLESPACE &4 ; ..http://tonguc.wordpress.com/2007/11/29/linux-and-shell-scripting-part-2/

Maybe you are looking for

  • Analysis Authorization Object not working

    Hi Gurus, I m working on BI 7.0, I have created an analysis authorization object zz_div for 0DIVISION characteristic. For a given report i want a given user to view only data for '32' and '33' 0DIVISION. I have followed the below steps but still the

  • Screen Sharing and MobileMe

    Hi There, I have a problem, I have a MobileMe account, as does my brother who is currently at university in the US, Im working out of an Apple Mac Pro that is going into a BeBox Speedtouch. Typically, when i'm at work i can connect via 'Back to My Ma

  • Uploading files takes a long time

    And when I say long time, I mean a ridiculously long time.  Hours at least.  Sometimes I have to leave my laptop on overnight to upload one song.  I know downloading fast is more important, but for music I make myself or friends make it just takes FO

  • CAN Read using Frame API

    I'm working with raw CAN data. The protocol sends out response as raw bytes(8 or upto 30)  on CAN Bus when data is requested by a CAN message. Example: Tx : Message ID with number of bytes you want to receive Tx   12X   30 00 00 00 00 00 00 00 You'll

  • Cannot connect to network with XP

    Hi Please ca anyone help. I have a network set up with three macs connecting wirelessly without a hitch. I am trying to connect a windows laptop with XP but with no luck. Airport setup assistant finds the base station and attempts to connect and stat