UDF-how to write query

Hi
I have UDF on form. How to make query, to choose values values from OITM in U_MODEL where U_BRAND = definite value

Hi,
1.Use same query (as attached in screen shot) and assign to U_model as per attached below.
2. To get list, just Press shift + F2 at U_model
Thanks & Regards,
Nagarajan

Similar Messages

  • How to write query for this in TopLink ?

    I am doing a simple search in jsp where the search will the based on the choices chosen by user.
    I had given 3 check boxes for those choices.
    The problem is, query will be based on the choice or choices chosed by the user.
    How to write query for this in TopLink ?
    Thanks in Advance..
    Jayaganesh

    Try below solution, it is NOT best solution but might work:
    Declare @Questions TABLE (QuestionID INT, QuestionText Varchar(100))
    INSERT INTO @Questions
    VALUES (1, 'Comment'), (2, 'Score')
    DECLARE @Answers TABLE (authkey INT, QuestionID INT, questiontext VARCHAR(100), answertext VARCHAR(100))
    INSERT INTO @Answers
    VALUES (101, 1, 'comment', 'hi!!'), (101, 2, 'score', '4'), (102, 1, 'comment', 'excellent'), (102, 2, 'score', '5'), (103, 2, 'score', '6'), (104, 2, 'score', '8')
    SELECT
    A.AuthKey
    ,Q.QuestionID
    ,Q.QuestionText
    ,A.AnswerText
    FROM
    @Questions Q
    INNER JOIN @Answers A ON Q.QuestionID = A.QuestionID
    UNION
    SELECT
    A.AuthKey
    ,Q.QuestionID
    ,Q.QuestionText
    ,Null
    FROM
    @Questions Q
    CROSS JOIN @Answers A
    WHERE
    NOT EXISTS (SELECT 1 FROM @Answers SubQry WHERE SubQry.AuthKey = A.AuthKey AND SubQry.QuestionID = Q.QuestionID)
    Output
    AuthKey | QuestionID
    | QuestionText
    | AnswerText
    101 | 1 | Comment | hi!!
    101 | 2 | Score | 4
    102 | 1 | Comment | excellent
    102 | 2 | Score | 5
    103 | 1 | Comment | NULL
    103 | 2 | Score | 6
    104 | 1 | Comment | NULL
    104 | 2 | Score | 8
    Best Wishes, Arbi; Please vote if you find this posting was helpful or Mark it as answered.

  • How to write query to list all the employees of deptno 20

    Hi ,
    I am new to Oracle...Recently I got job.... Could you please help me....
    How to write a query for
    1) List all the Clerks of Deptno 20 and
    2) List the emps along with their exp and whose daily salary is more than 100rs

    its not wrong that you ask , but this is basic question and my suggestion is to start reading some manual specially since you got job , Read oracle documentation gogole what you want if you didn't find any answer post here and we will help you .
    Check this link
    http://www.oracle-dba-online.com/sql/oracle_sql_tutorial.htm
    http://www.w3schools.com/sql/default.asp
    http://www.java2s.com/Tutorial/Oracle/CatalogOracle.htm
    And you will find more & more .. create your own vmware oracle provide with learning database called XE (express edition) test it and hope this information is useful for you

  • How to write query group by  time(minutes)

    Hi,
    i am writting query like this.
    select host_id,pd_user, pdUserUtil,
    timestamp from
    (select host_id,pd_user,
    avg(pd_cpu) pdUserUtil,
    to_Char(PD_REPORTED_TIMESTAMP,'yyyy-mm-dd hh:MI') timestamp
    from sp_process_detail_current SP
    where exists (select * from
    sp_process_detail_current
    having
    max(PD_REPORTED_TIMESTAMP)-sp.PD_REPORTED_TIMESTAMP<5/1440)
    group by pd_user,host_Id,to_Char(PD_REPORTED_TIMESTAMP,'yyyy-mm-dd hh:MI'))
    where host_id='DSCP04881' and pd_user='TOMCAT'
    TIMESTAMP PD_USER
    2006-06-30 08:07 TOMCAT
    2006-06-30 08:08 TOMCAT
    2006-06-30 08:10 TOMCAT
    BUT WHILE ACCESSING IN JAVA
    java.lang.NumberFormatException: For input string: "30:08:07"
    at java.lang.NumberFormatException.forInputString(NumberFormatException.

    Question: What datatype in Java are you using as placeholder for the timestamp column?
    It's only taking the "2006-06-" part.
    Post here the java code (an exceprt of course), though I feel there's better forums for this subject.

  • How to write query

    Hi,
    I need expert advice.
    on daily basis we are updating meter reading ( meter reading is nothing but "meter number / unit / date".
    Let say there are 10 apartment  and each apartment has separate meter.
    i need to write query get missing meter reading on a specific date.
    Thanks

    Unit Master
    401
    402
    403
    404
    Daily Meter Reading
    date               unit     meter
    01-01-01          1     401
    01-01-01          1     402
    01-01-01          1     404  ( on 1st of jan user update the meter reading but if you notice unit number 403 is missing)
    02-01-01          1     401
    02-01-01                402 ( on 2nd of jan user update the meter reading but if you notice this time 402 is meter unit is missing)
    02-01-01          1     403
    02-01-01          1     404
    03-01-01                  401
    03-01-01          1     402
    03-01-01          1     403 ( on 3rd of jan user update the meter reading but if you notice this time meter unit is missing for 401 and 404 is unit is missing)
    We want the following output
    if user run report on 1st of jan system should return value of 403 unit number
    if user run report on 2nd of jan then system should return value of 402 unit number
    if user run report on 3rd of jan then system should return value of 401/404 unit number
    Hope this help to get my expected answer.

  • QUESTION:  HOW TO WRITE QUERY  WITH MANY TO MANY RELATIONSHIPS

    Could someone help me out here?
    I was sitting here looking at some tables ie table_name and synonyms and wondering.
    If a table can belong to many synonyms and a synonym can belong to many tables how would one write a query where I would like to know which tables belong to each synonym or on the other hand which synonym belongs to what tables?
    Would I try to develop an outside join for this, a corrolated query or a query with a subquery or would there be another format that would work better?
    What would be the best method of attack on this?
    Thanks for your thoughts on this.
    al

    Actually, the relationship is not many to many. A table can have many synonyms, but a synonym within a namespace (i.e. a PUBLIC synonym, or a private synonym created by a user) can only point to one table. The xxx_synonmys tables already contain the information about the table_name and table_owner.
    John

  • How to write query for shuttle box

    hi
    i am creating an shuttle box on my input page and need to write a query to display the selected columns in the shuttle box..
    i have created the shuttle bottle and gave the static values in it , i can view my values but cannot understand how to give the condition which allows me to display the data
    only for selected columns ...
    Please Help

    thank you for reply..
    I am completely new to oracle apex...i think here there is a prcodure to get default values into the right side box, my question is , how do i write a query for all the items in the left side box columns when selected to right side, the data has to be displayed only for those columns...
    i am looking for syntax of the query ...
    For eg there 4 columns on the left hand side of the shuttle box
    job_id
    cluster_id
    cluster_code
    cluster_name
    and i select just job_id and cluster_id to right hand side , i need to display data associated with only these 2 columns...
    Please Help
    Edited by: user12855387 on Apr 20, 2010 11:08 AM

  • How to write query for this scenario

    Hi - 
    I have two table like this: 
    Question: 
    questionid  questiontext
    1 comment
    2 score
    Answer:
    authkey  questionid
    questiontext answertext
    101 1 comment hi!!
    101 2 score 4
    102 1 comment excellent
    102 2 score 5
    103 2 score 6
    104 2 score 8
    Here there are  two question (score and comment) and answer is stored in answer table. there are case when there is no comment and only answer. but answer would always be there in answer table for each authkey. 
    I want to write the query that gives the result that if no comment is given for authkey then return null as answer. something like below: 
    Desired Result: 
    authkey questionid questiontext
    answertext
    101 1 comment hi!!
    101 2 score 4
    102 1 comment excellent
    102 2 score 5
    103 2 score 6
    103 1 comment null
    104 2 score 8
    104 1 comment null
    what query can i write to get the above desired result. 
    Thanks in advance

    Try below solution, it is NOT best solution but might work:
    Declare @Questions TABLE (QuestionID INT, QuestionText Varchar(100))
    INSERT INTO @Questions
    VALUES (1, 'Comment'), (2, 'Score')
    DECLARE @Answers TABLE (authkey INT, QuestionID INT, questiontext VARCHAR(100), answertext VARCHAR(100))
    INSERT INTO @Answers
    VALUES (101, 1, 'comment', 'hi!!'), (101, 2, 'score', '4'), (102, 1, 'comment', 'excellent'), (102, 2, 'score', '5'), (103, 2, 'score', '6'), (104, 2, 'score', '8')
    SELECT
    A.AuthKey
    ,Q.QuestionID
    ,Q.QuestionText
    ,A.AnswerText
    FROM
    @Questions Q
    INNER JOIN @Answers A ON Q.QuestionID = A.QuestionID
    UNION
    SELECT
    A.AuthKey
    ,Q.QuestionID
    ,Q.QuestionText
    ,Null
    FROM
    @Questions Q
    CROSS JOIN @Answers A
    WHERE
    NOT EXISTS (SELECT 1 FROM @Answers SubQry WHERE SubQry.AuthKey = A.AuthKey AND SubQry.QuestionID = Q.QuestionID)
    Output
    AuthKey | QuestionID
    | QuestionText
    | AnswerText
    101 | 1 | Comment | hi!!
    101 | 2 | Score | 4
    102 | 1 | Comment | excellent
    102 | 2 | Score | 5
    103 | 1 | Comment | NULL
    103 | 2 | Score | 6
    104 | 1 | Comment | NULL
    104 | 2 | Score | 8
    Best Wishes, Arbi; Please vote if you find this posting was helpful or Mark it as answered.

  • How to write query with low cost

    hi
    i want to write a query of low cost for the following scenario.
    in a table
    if a person got a salary >=10000 he is in grade A
    if a person got salary >=7000 he is in grade B
    if a person got salary >=5000 he is in grade C
    if a person got salary >=3000 he is in grade D
    else grade E.

    use CASE
    case when salary >= 10000 then 'A'
           when salary >= 7000 then 'B'
           else 'E'
    end as grade
         

  • How to write query to enlist OAF personalizations done by user

    Hi All,
    I need query which will tell me what are the OAF personalizations done by user, excluding seeded personalzaition done by Oracle.
    --Parag                                                                                                                                                                                                                                                                                                           

    I think someone should look at this, as this will be very useful for all.
    --Parag Narkhede                                                                                                                                                                                           

  • How to write query for this?

    Hello ppl!
    See, I am making a search application. I have a text field and a button on my screen. Now suppose i want to search for "abc", the search is succesful, but when i search for "a*", no results are shown.
    So what should be query which will satify both the scenarios?

    you asking about wild card search in SELECT statements?
    The following is the help on wild card search in SELECT statements
    ... WHERE CITY LIKE '%town%'.
    This condition is true if the column CITY contains a string containing the pattern ‘town’.
    ... WHERE NAME NOT LIKE '_n%'.
    This condition is true if the column NAME contains a value whose second character is not ‘n’.
    <b>... WHERE FUNCNAME LIKE 'EDIT#_%' ESCAPE '#'.
    This condition is true if the contents of the column FUNCNAME begin with EDIT_.</b>

  • HOW TO WRITE QUERY OR PL/SQL PROGRAM FOR THIS

    I HAVE TABLE X
    SELECT ENO FROM X
    ENO
    123
    423
    332
    562
    678
    986
    621
    WHEN I RUN PL/SQL PROGRAM I WILL PASS PARAMETER
    FOR EXAMPLE LIKE 134
    I NEED OUTPUT LIKE
    134 EXIST OUTPUT
    123
    423
    332
    562
    621
    134 NOT EXIST OUTPUT
    678
    986
    Regards
    Dev

    This?
    <tested in TOAD>
    SQL> accept my_parm
    old: with t as (
    select '123' eno from dual union all
    select '423' from dual union all
    select '332' from dual union all
    select '562' from dual union all
    select '678' from dual union all
    select '986' from dual union all
    select '621' from dual )
    select eno || ' ' || output_type results
    from (
    select to_char(&&my_parm) eno, 'EXIST OUTPUT' output_type, 1 output_id
    from dual union all
    select null eno, null output_type, 3 output_id
    from dual union all
    select to_char(&&my_parm) eno, 'NOT EXIST OUTPUT' output_type, 4 output_id
    from dual union all
    select
    eno,
    null,
    case when regexp_instr(eno,'[' || &&my_parm || ']') >0
    then 2
    else 5
    end output_id
    from t
    order by output_id, eno
    new: with t as (
       select '123' eno from dual union all
       select '423' from dual union all
       select '332' from dual union all
       select '562' from dual union all
       select '678' from dual union all
       select '986' from dual union all
       select '621' from dual )
    select eno || ' ' || output_type results
    from (
       select to_char(134) eno, 'EXIST OUTPUT' output_type, 1 output_id
       from dual union all
       select null eno, null output_type, 3 output_id
       from dual union all
       select to_char(134) eno, 'NOT EXIST OUTPUT' output_type, 4 output_id
       from dual union all
       select  
          eno,
          null,
          case when regexp_instr(eno,'[' || 134 || ']') >0
             then 2
             else 5
          end output_id
       from t
    order by output_id, eno
    SQL> with t as (
       select '123' eno from dual union all
       select '423' from dual union all
       select '332' from dual union all
       select '562' from dual union all
       select '678' from dual union all
       select '986' from dual union all
       select '621' from dual )
    select eno || ' ' || output_type results
    from (
       select to_char(134) eno, 'EXIST OUTPUT' output_type, 1 output_id
       from dual union all
       select null eno, null output_type, 3 output_id
       from dual union all
       select to_char(134) eno, 'NOT EXIST OUTPUT' output_type, 4 output_id
       from dual union all
       select  
          eno,
          null,
          case when regexp_instr(eno,'[' || 134 || ']') >0
             then 2
             else 5
          end output_id
       from t
    order by output_id, eno
    RESULTS            
    134 EXIST OUTPUT   
    123                
    332                
    423                
    621                
    134 NOT EXIST OUTPUT
    562                
    678                
    986                
    10 rows selected.Message was edited by:
    MScallion

  • How to write query to get the following o/p

    Hi i've the following data and
    create table hirarchical(prnt_id number,child_id number)
    insert into hirarchical values(1,2)
    insert into hirarchical values(1,3)
    insert into hirarchical values(1,4)
    insert into hirarchical values(2,5)
    insert into hirarchical values(2,6)
    insert into hirarchical values(2,7)
    insert into hirarchical values(3,8)and
    If i give in where condition prnt_id=1 then
    the o/p should be 7 instead of 1 as it's having all connected childs...
    thanks in advance

    user10502250 wrote:
    If my reply is correct or helpful please mark it so.Begging for points is unprofessional and considered poor netiquette. It also makes a mockery of the already poor points system, by putting pressure on the original poster to award points for answers that may or may not be the most helpful or correct. If your answer is correct or helpful and meets the needs of the original poster then it is entirely up to them to award points as they see fit when they feel they have had sufficient answers or responses. Most of the people on the forum who have gained a lot of points have done so through providing good answers and without needing to ask for them. Please avoid such begging in future.

  • How to write query for this given information???

    I have table (employees) like this
    Hire_date
    Salary
    04-jan-1991
    2000
    05-mar-1991
    1300
    12-sep-1991
    2400
    19-feb-1992
    3000
    17-apr-1992
    1000
    23-nov-1992
    1200
    25-jan-1993
    1000
    06-jun-1993
    1200
    I want  to get output like this
    Hire_date
    Salary
    Years in range
    total
    04-jan-1991
    2000
    05-mar-1991
    1300
    12-sep-1991
    2400
    01-jan-1991 to 31-dec-1991
    5700
    19-feb-1992
    3000
    17-apr-1992
    1000
    23-nov-1992
    1200
    01-jan-1992 to 31-dec-1992
    4200
    25-jan-1993
    1000
    06-jan-1993
    1200
    01-jan-1993 to 31-dec-1993
    2200
    give me some ideas guys

    Without using analytic functions,
    select
         hire_date,salary,
         decode(hire_date,null,extract(year from hire_date)) year_tag,
         decode(hire_date,null,sum(salary)) total_sal
    from
         employees
         group by grouping sets ((hire_date,salary,extract(year from hire_date)),extract(year from hire_date),())
    Output
    HIRE_DATE    SALARY  YEAR_TAG TOTAL_SAL
    04-JAN-91      2000
    05-MAR-91      1300
    12-SEP-91      2400
                             1991      5700
    19-FEB-92      3000
    17-APR-92      1000
    23-NOV-92      1200
                             1992      5200
    25-JAN-93      1000
    06-JUN-93      1200
                             1993      2200
                                      13100

  • How to Write query to order by

    if have like this
    select empno,ename from employee
    order by :choice (i want to select user from list empno or ename for order by)
    but it doesnt work

    Hi,
    you should use "&choice" instead of ":choice".
    You must have a placeholder field named "choice" and you must initialize this field with either "empno" or "ename".
    Bye
    Raffy

Maybe you are looking for