How to write the sql statement of my finder function in cmp?

hi,
I create a cmp ejb from table INFOCOLUMN,and I create a my finder function ,which sql statement is :
select * from INFOCOLUMN WHERE employee_id=id
employee_id is a column of the table,and id is the finder function parameter.
The error is : invalid column name
So,how to write the sql statement.
Thanks .

Mole-
Bind variables are of the form $1, $2, etc., so your query stmt should look like:
select * from INFOCOLUMN WHERE employee_id=$1
-Jon

Similar Messages

  • How to isolate the Sql Statement from Java Code

    Hi
    I Need to know that can we segregate the Sql Statements and convert them to Stored Procedures so as to isolate the Sql statements from Java Code.
    So i have one static web page which uses four select Statements so what i want is to create a stored procedure encapsulating these queries. So that the Java Web Developer will simply call the Stored Procedure instead of using four different SQL Statements.
    Suppose the developer has these four Statements
    Select ename,empno,sal,job from emp;
    select empno,ename,mgr from emp;
    select deptno,dname from dept;
    select emp.ename,emp.empno,emp.deptno,dept,dname fromemp,dept;
    So can i encapsulate these four Sql Statements in one Procedure and the Web developer can call the Store procedure and dont need to write the Sql Statements in his code.
    Can Anybody guide me how to write this Stored type of Store procedure.
    Thanks

    http://www.google.com/search?q=java+windows+registry
    Next time, search yourself. It might be beyond your belief, but you're really, really not the first person to wonder about this.

  • How to put the SQL-statement returned value into the field (as a default)

    Hi,
    I am using Developer/2000 (Forms Designer) under windows 98.
    Please tell me how to put the SQL-statement value (as a default value) into the field before enter-query mode. Noted that I have tried the following ways but still some problems:-
    1) Place the SQL-statement into PRE_QUERY trigger in the form/block level.
    There is a message box which ask 'Do you want to save the changes?'.
    2) Place the SQL-statement before execute enter_query. There is still a
    message box which ask 'Do you want to save the changes?'.
    Any hints? Thanks. Urgent.

    solved it!
    1) Suppress DEFAULT save message
    if form_failure then
    raise form_trigger_failure;
    end if;
    2) Place the default value before enter-query.
    Ref: Title='Default value in query field in ENTER_QUERY mode' in designer forum by CVZ
    form level trigger
    ============
    WHEN-NEW-ITEM-INSTANCE
    =======================
    if :system.mode = 'ENTER-QUERY' then
    :block.item := 'default waarde';
    end if;
    3) Suppress the changes whenever leaving the default field.
    if :block.item is null then
    -- assign statement
    end if;

  • How to view the SQL statement generated during execution of the BW Query?

    Dear Experts,
    I am trying to retrieve data in a SAP BW Query from a Non-SAP system.
    I think if I am able to see the complete SQL statement that was generated when I executed the BW Query, I may be able to use it to retrieve the data.
    Do you know how and where I can see the SQL statement of a BW Query's SQL statement?
    I tried RSRT options to execute the Query but still could not find the SQL statement.
    Thanks in advance.
    Regards,
    Shunhui.

    hi
    goto rsrt
    give your query name
    select execute + debug option
    in the debug option under data manager check the check box "display SQL/BIA query
    selcet continue
    you can see the sql statement
    thanq

  • How to monitor the sql statement running?

    Hi ,
    i need to check the status of the sql script running on the database.
    what is the way to chect that?
    if the particular query is taking very long time what might be the reason?

    Since you are [relatively] new at this ..
    the recommended technique will change based on version of Oracle database, the edition of the database, the options of the database and the operating system.
    For example, I would normally suggest a newbie with Oracle Database 10g or 11g Enterprise Edition to use the Enterprise Manager Diagnostics Pack. A demo thereof is on the Oracle BY Example site (http://otn.oracle.com) - look for Tutorials towards the top.
    As for why ... it's waiting on things. Which things may depend on the database, the operating system, the disk subsystem, the network subsystem, memory allocation, sorting, other load, and even how well or badly the SQL statement was written.

  • How to get the SQL statement

    I cannot figure how to get the text(SQL statement) from a system view(i guess it is in a system view... but witch??). 'Till now i have the sql_address and the sql_hash_value..
    I know it is possible.. EM does it ... so i should be able to do the same..
    ps:I use 9.2

    v$sql ?

  • How to get the SQL Statement of a report region?

    For example: The SQL of report region such as "SELECT A,B,C FROM T1 WHERE A = :P10_A".
    I hope to get the converted statement (the variable has been replaced), like this:
    :P10_A = 'TOM', SQL: "SELECT A,B,C FROM T1 WHERE A = 'TOM'".
    THX.

    I agree with John with the usual caveat about using bind variables.
    In other words, you should use
    SELECT A,B,C FROM T1 WHERE A = :P10_Ainstead of SELECT A,B,C FROM T1 WHERE A = 'foo'so that the shared pool doesn't get clutterred with copies of the same (sharable) SQL.
    Even if you use the "PL/SQL function returning a SQL query", be sure to use bind variables in your SQL and not "glue in" session state by concatenating it into the query.
    Thanks.

  • How to trace the SQL statements executed in a database

    I am using Oracle9i Enterprise Edition Release 9.2.0.7.0 - 64bit Production on a sun server and I am not familiar with Oracle but with MS SQL there is a tool called profiler, it allows you to monitor and see what is going on in a specific databases whether it is SQL statement executins or anything else. I have installed the oracle enterpise manager console at my windows client and I tried to look for a tool similar to the profiler in the MS SQL. I tried the TRACE DATA VIEWER and I inputed the login credentials but I don' t actually know the service name and I am getting an error ORA-12514 The TSN listener can not resolve the service name given in the connect descriptor. Therefore, am I on the right road so i have to look for the service name or are there any other ways i can trace the currently executing SQL statement in a specific database. I am really stuck there. I would appreciate if somebody help me out. Thanks
    Abdel Moalim

    Abdel Moalim wrote:
    I am using Oracle9i Enterprise Edition Release 9.2.0.7.0 - 64bit Production on a sun server and I am not familiar with Oracle but with MS SQL there is a tool called profiler, it allows you to monitor and see what is going on in a specific databases whether it is SQL statement executins or anything else. I have installed the oracle enterpise manager console at my windows client and I tried to look for a tool similar to the profiler in the MS SQL. I tried the TRACE DATA VIEWER and I inputed the login credentials but I don' t actually know the service name and I am getting an error ORA-12514 The TSN listener can not resolve the service name given in the connect descriptor. Therefore, am I on the right road so i have to look for the service name or are there any other ways i can trace the currently executing SQL statement in a specific database. I am really stuck there. I would appreciate if somebody help me out. Thanks
    Abdel MoalimHi
    I see others have answered the network connectivity issues, I'll try and address the tracing issue. Your best bet is to review http://www.petefinnigan.com/ramblings/how_to_set_trace.htm for the many ways in which a sessions SQL and indeed other activity can be traced. In version 7 (which I'm guessing is yours from the sid) the only profiler available was tkprof (Trace Kernel Profiler) which will do a good job of analysing your trace file. The trace files themselves are generated on the server in a protected directory so you may need to ask your dba for access to them. There are other profilers around now (I have one which runs in v9 and higher database at http://www.niall.litchfield.dial.pipex.com/SimpleProfiler/SimpleProfiler.html which will analyse your files for example) but tkprof is the start point - or else just reading the trace file in a text editor. There is also a utility written by the Oracle Apps guys trcanalyzer that will do a good job for you. In general the interface is poor compared with the ms utility but the information is deeper and more helpful
    Niall Litchfield
    http://www.orawin.info/

  • How to write the SQL?

    I have a nested table as following:
    create type mytype as table of number(5,0);
    create table test(
    a number(5),
    b mytype
    nested table b store as test_b_tab;
    And the table has the following dataF
    a b
    1 1
    2
    3
    Q1. If I wanna delete b = 3 where a = 1. What should I do in SQLH
    Q2. If I wanna set b = 8 where a = 1 and b = 3. What should I do in SQL?
    Give me a hand, please.
    And thank you first!

    HI,
    SEE HOW TO WORK ON NESTED AND VARRAY TABLES AND WRITE YOUR QUERIES AS YOUR WISH.......
    --//CREATING THE VARRAYS AND NESTED TABLES
    --//AND DOING THE DML OPERATIONS ON IT     
    SQL> create type book as object(id number, name varchar2(20));
    2 /
    Type created.
    SQL> create type booklist as varray(10) of book;
    2 /
    Type created.
    SQL> create type booklisttab as table of book;
    2 /
    Type created.
    SQL> create table my_tabv(slno number(10) primary key, name varchar2(20), books booklist);
    Table created.
    SQL> create table my_tabnst(slno number(10) primary key, name varchar2(20), books booklisttab)
    2 nested table books store as books_store;
    Table created.
    SQL> INSERT INTO MY_TABV VALUES (1, 'KHALEEL',BOOKLIST(BOOK(1,'ENGLISH'),BOOK(2,'HINDI')));
    1 row created.
    SQL> INSERT INTO MY_TABV VALUES (2,'MOHAN',BOOKLIST(BOOK(1,'ENGLISH'),BOOK(2,'TELUGU')));
    1 row created.
    SQL> INSERT INTO MY_TABV VALUES (3,'SRIDHAR',BOOKLIST(BOOK(1,'SANSCRIT'),BOOK(2,'TAMIL')));
    1 row created.
    SQL> INSERT INTO MY_TABNST VALUES(1,'KHALEEL',BOOKLISTTAB(BOOK(1,'ENGLISH'),BOOK(2,'HINDI')));
    1 row created.
    SQL> INSERT INTO MY_TABNST VALUES(2,'MOHAN',BOOKLISTTAB(BOOK(1,'ENGLISH'),BOOK(2,'TELUGU')));
    1 row created.
    SQL> INSERT INTO MY_TABNST VALUES(3,'SRIDHAR',BOOKLISTTAB(BOOK(1,'SANSCRIT'),BOOK(2,'TAMIL')));
    1 row created.
    SQL> SQL> SELECT * FROM MY_TABV;
    SLNO NAME
    BOOKS(ID, NAME)
    1 KHALEEL
    BOOKLIST(BOOK(1, 'ENGLISH'), BOOK(2, 'HINDI'))
    2 MOHAN
    BOOKLIST(BOOK(1, 'ENGLISH'), BOOK(2, 'TELUGU'))
    3 SRIDHAR
    BOOKLIST(BOOK(1, 'SANSCRIT'), BOOK(2, 'TAMIL'))
    SQL> SELECT * FROM MY_TABNST;
    SLNO NAME
    BOOKS(ID, NAME)
    1 KHALEEL
    BOOKLISTTAB(BOOK(1, 'ENGLISH'), BOOK(2, 'HINDI'))
    2 MOHAN
    BOOKLISTTAB(BOOK(1, 'ENGLISH'), BOOK(2, 'TELUGU'))
    3 SRIDHAR
    BOOKLISTTAB(BOOK(1, 'SANSCRIT'), BOOK(2, 'TAMIL'))
    SQL> insert into table(select books from my_tabnst where slno=1) values(3,'BENGALI');
    1 row created.
    SQL> select name from table(select books from my_tabNST where slno=1);
    NAME
    ENGLISH
    HINDI
    BENGALI
    *****************************Khaleel*******************

  • How to write the SQL codes  of the login system for a database system

    If I have a table stored with a Column staff_ID and Password. How can I make use of this 2 columns information to setup the login system?

    Hi,
    Create Table Modules          -----e.g. payroll, inventory etc.
    (ModID    NUMBER(10),
    ModName  VARCHAR2(50)); 
    Create Table Modules_Forms    ------e.g. Sales Transaction Form
    (FormID   NUMBER(10),
    ModID    NUMBER(10),
    FmxName  VARCHAR2(32));           
    Create Table Modules_Reports  ------e.g. Sales Report
    (RepID    NUMBER(10),
    ModID    NUMBER(10),
    RepName  VARCHAR2(32));           
    Create Table Usr              ------------From the Employee Information Module
    (UserID   VARCHAR2(20),       ------------you can find the designation of
    Password VARCHAR2(10)        ------------the user who wants to connect
    Emp_Code Varchar2(25));      ------------that is why, I am Addng Emp_Code.
    Create Table User_Modules     ------------Control the Module Access.
    (UserID   VARCHAR2(20);
    ModID    NUMBER(10),
    Access   VARCHAR2(1));
    Create Table User_Forms       ------------Control the Forms Access
    (UserID   VARCHAR2(20),
    FormID   NUMBER(10),
    Read     VARCHAR2(1),
    Write    VARCHAR2(1),
    Execute  VARCHAR2(1),
    Delete   VARCHAR2(1));
    Create Table User_Reports     ------------Control the Report Access
    (UserID   VARCHAR2(20),
    RepID    NUMBER(10),
    Access   VARCHAR2(1));
    1 ) After Creating these Tables, Control the Application Access of the users
        From the application (Oracle Forms).
    2 ) I think you should create a Menu from oracle forms.
    3 ) For Controlling the Database Level Access, you can create a ROLE
    4 ) Forms Forum Site:-
        http://www.forums.oracle.com/forums/forum.jsp?forum=82Regards
    Muhammad Waseem Haroon
    [email protected]

  • How to write the SQL query for generating triangular numbers

    Hi,
    I have a table ..which stores the sequence number like this
    Seq :
    1000
    1200
    1300
    1500
    1800
    1900
    Now i want to get a result like this
    1000 1000
    1200 2200
    1300 3500
    1500 5000
    1800 6800
    1900 8700
    how can it be achieved. I tried using Lead and lag. but only I can add the n+1 or n-1 results. Please help.

    I've never heard it called 'triangular numbers' before but I think you're looking for a 'running total':
    SQL> WITH data AS
      2  (
      3     SELECT 1000 AS num FROM dual UNION ALL
      4     SELECT 1200 AS num FROM dual UNION ALL
      5     SELECT 1300 AS num FROM dual UNION ALL
      6     SELECT 1500 AS num FROM dual UNION ALL
      7     SELECT 1800 AS num FROM dual UNION ALL
      8     SELECT 1900 AS num FROM dual
      9  )
    10  /* END SAMPLE DATA */
    11  SELECT num, SUM(num) OVER (ORDER BY num) AS running_total
    12  FROM   data
    13  ORDER BY 1
    14  ;
           NUM RUNNING_TOTAL
          1000          1000
          1200          2200
          1300          3500
          1500          5000
          1800          6800
          1900          8700
    6 rows selected.

  • How to write the SQL for the following

    ID     PRODUCT     LEAD_FLAG     SALES_VOLUME
    1     A     Y     100
    1     B     N     200
    1     C     N     300
    1     D     N     400
    2     A     N     10
    2     B     Y     20
    2     C     N     30
    2     D     N     40
    I need to calculate the incentive for each ID. The rule is for an ID:
    if the the lead flag for a product is N, then check the sales_volume of the product whose lead_flag is Y (product A in case of ID 1, product B in case of ID 2). if the sales_volume of the product with lead_flag = Y is greater than a NUMBER (this NUMBER varies from product to product. for product A it is 20, for product B it is 25, C it is 30 and D it is 40) then incentive = (sales_volume of the product with lead flag N) * 100.

    Hello, I presume the NUMBER you refer to will be held in a table column somewhere? I'm calling it threshold_num in the test data below (and rec_id instead of ID):
    WITH test_data AS (
    SELECT 1 REC_ID, 'A' PRODUCT, 'Y' LEAD_FLAG,  100 SALES_VOLUME FROM DUAL UNION ALL
    SELECT 1, 'B','N', 200 FROM DUAL UNION ALL
    SELECT 1, 'C','N', 300 FROM DUAL UNION ALL
    SELECT 1, 'D','N', 400 FROM DUAL UNION ALL
    SELECT 2, 'A','N', 10 FROM DUAL UNION ALL
    SELECT 2, 'B','Y', 20 FROM DUAL UNION ALL
    SELECT 2, 'C','N', 30 FROM DUAL UNION ALL
    SELECT 2, 'D','N', 40 FROM DUAL),
    test_ref_data AS (
    SELECT 'A' PRODUCT, 20 threshold_num FROM DUAL UNION ALL
    SELECT 'B', 25 FROM DUAL UNION ALL
    SELECT 'C', 30 FROM DUAL UNION ALL
    SELECT 'D', 40 FROM DUAL)
    -- end test data
    SELECT td1.REC_ID, td1.PRODUCT, CASE WHEN td2.PRODUCT IS NOT NULL THEN td1.sales_volume * 100 ELSE 0 END incentive
      FROM test_data td1
       LEFT JOIN (
        SELECT td2.PRODUCT, SUM(sales_volume) sales_volume
         FROM test_data td2
         JOIN test_ref_data trd
            ON (td2.PRODUCT = trd.PRODUCT)
       WHERE td2.lead_flag = 'Y'
        GROUP BY td2.PRODUCT, trd.threshold_num HAVING SUM(td2.sales_volume) > trd.threshold_num) td2
        ON (td1.PRODUCT = td2.PRODUCT)
    WHERE td1.lead_flag = 'N';
        REC_ID PROD  INCENTIVE
             2 A       1000
             2 D          0
             1 D          0
             1 B          0
             2 C          0
             1 C          0
    6 rows selected.And two tips: it's always helps to put {noformat}{noformat} before and after your code for readability, and also to provide expected sample output.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to write a sql query to retrieve data entered in the past 2 weeks

    Hi,
    I have file names and last accessed date(java.sql.Date format) stored in my database table, I would like to know how I can write a query to get the name of files accessed in the past 2 weeks,I use open sql server at the back end.
    Thanks in advance.

    This has essentially nothing to do with JDBC. JDBC is just an API to execute the SQL language using Java and thus interact with the databases.
    Your problem is related to the SQL language, you don't know how to write the SQL language. I suggest you to go through a SQL tutorial (there is one at w3schools.com) and to read the SQL documentation which come along with the database in question. A decent database manfacturer has a website and probably also a discussion forum / mailinglist as well.
    I'll give you a hint: you can just use equality operators in SQL like everywhere. For example: "WHERE date < somedate".

  • How to write a case statement for the totals column of two different years (2013 and 2014) of the same month so that I can get a +/- column

    Please Help!!!
    How to write a case statement for the totals column of two different years (2013 and 2014) of the same month so that I can get a +/- column.
                                      January 2014         January
    2013                            +/-
                    Region   Entry   Exit  Total    Entry   Exit   Total   (Total of Jan2014-Total of Jan2013)
                    A               2         3      
    40        5       7        30                    40-30= 10

    What is a table structure? Sorry cannot test it right now..
    SELECT <columns>,(SELECT Total FROM tbl WHERE Y=2014)-(SELECT Total FROM tbl WHERE Y=2013)
    FROM tbl
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • How can I write a SQL statement which checks if a table exists?

    How can I write a SQL statement which tells me whether a table exists?

    execute an sql query: select * from <tablename>
    catch the exception n check whether the erroe code
    matches the one that occurs for table doesn't exist
    that's itHow is your answer any different from the one given in the first reply?
    It isn't.
    As WorkForFood says DatabaseMetaData has a bunch of methods for getting information about tables but this is more useful when you don't know the names of any of the tables.. it sounds like you do so I would concur SELECT from table is probably the quickest way to go. If it helps the Xopen error should be either S1000 or 42S01 (I think) but I would try and see if there is a specific vendor code for table not found/not exists error and check for that.

Maybe you are looking for

  • Looping issues

    Ok – I have a 2 bar drum loop, and I like the tempo of the loop. I am trying to keep that tempo and have all the beats – the "2" & "4" to line up on the grid. I can do this in other "Pro Tools & I'm not that good with Pro Tools – but having difficult

  • Not able to run my webobject project on WO5.4

    When I am trying to run my WebObject project,it stops running and the following message is displayed on the console:- [2012-12-21 09:19:19 PST] <main> WOMaxIOBufferSize=8196 [2012-12-21 09:19:19 PST] <main> WOWorkerThreadCountMin=16 [2012-12-21 09:19

  • -50405 Error at DAQmx Read AI Sample

    Anyone seen this error before?  The Possible Reasons are: No transfer is in progress because the transfer was aborted by the client. The operation could not be completed as specified. I am using the DAQmx Analog 2d DBL NChan Nsamp function and gettin

  • I CAN NOT BELIEVE APPLE OFFERS NO PHONE CUSTOMER SERVICE FOR ITUNES USERS!

    I have been unable to access my purchased music on my new computer (the old one crashed before I could back up my purchased itunes music). I clicked "check for purchases," and received one of several television shows I purchased and NONE of the dozon

  • TS4002 how do I get contact list in alpha order?

    I moved an old contact list over, when I edit the iPhone list does not alphabetize.  How do I fix it?