Where clause requiring user input

I am a complete beginner at using SQL for Oracle.
I am using a program called Toad for Oracle to try and help;
See I am used to using the very simple Microsoft Query to build queries.
I am using Excel to use these queries for a bunch of reports, graphs and charts.
However, when I try and use Microsoft Query to build these queries I get a bunch of errors. Biggest one I can't get past is ORA-00972: identifier is too long.
Anyway, so I start trying to build my query in Toad for Oracle.
Is there a way like there is in Microsoft Query to write the Where Clause for user input.
Example:
MICROSOFT QUERY sample: Where A_COMPL_SUMMARY.ENTRY_DATE>= ?)
And (A_COMPL_SUMMARY.ENTRY_DATE<= ?)
And (A_COMPL_SUMMARY.ENTRY_DATE>=[Date1] And A_COMPL_SUMMARY.ENTRY_DATE<=[Date2])
Something like that.
Basically I'm wanting at this point of the query for excel to pop up a window for user to input what dates they want
So is there a way to do this in SQL. I can't seem to write it the "correct way". It doesn't like the ?'s or the "[ ]"'s
Please help!!!
Thank you,

When I try and copy/paste the SQL that I generated in Toad into Excel's query tool, 1st it tells me it can't be represented graphically. I select OK and then it gives me the "Microsoft Query has encountered a problem and needs to close. We are sorry for the inconvenience." my only options at this point are to Debug, Send Error Report, or Don't Send.
Maybe I'm going about this the wrong way. But I need to run this Sql in Excel so I can get the graphs and charts from the data it executes.

Similar Messages

  • Reversi Sample - "The project requires user input. Reload the project for more information."

    A week ago, I downloaded the sample code examples.  Then I extracted the reverse sample code, loaded it and ran it.  All was well.
    I was just using it as a resource for example code, so no code changes.  Now, when I open the project, I get nothing loaded.
    Solution explorer displays       Solution 'Reversi' (0 Projects).    Below that
    "The project requires user input.  Reload the project for more information."
    This message shows for all three sections  Reversi, ReversiGameComponet, and ReversiComponentTests.
    Ok, so I figure I must have accidently changed something.  So, I re-extract.  Same message. 
    The only thing I can think of is that in the options, I changed the startup location for my projects.  I like to keep my code projects on the d: drive, so I changed that to D:\!!!W8.  I've always done this so that when I create a new project,
    it does it in my project directory by default.  Didn't change anything else such as the templates dir.
    I did set this back to the c:....projects, as where templates are, but that didn't help.  So, I reset to my projects directory.
    My project that I created loads ok.
    Suggestions?

    A week ago, I downloaded the sample code examples.  Then I extracted the reverse sample code, loaded it and ran it.  All was well.
    I was just using it as a resource for example code, so no code changes.  Now, when I open the project, I get nothing loaded.
    Solution explorer displays       Solution 'Reversi' (0 Projects).    Below that
    "The project requires user input.  Reload the project for more information."
    This message shows for all three sections  Reversi, ReversiGameComponet, and ReversiComponentTests.
    Ok, so I figure I must have accidently changed something.  So, I re-extract.  Same message. 
    The only thing I can think of is that in the options, I changed the startup location for my projects.  I like to keep my code projects on the d: drive, so I changed that to D:\!!!W8.  I've always done this so that when I create a new project,
    it does it in my project directory by default.  Didn't change anything else such as the templates dir.
    I did set this back to the c:....projects, as where templates are, but that didn't help.  So, I reset to my projects directory.
    My project that I created loads ok.
    Suggestions?
    Hi there,
    Can you provide the link for the sample code example so I can download and try on my machine?
    Regards,

  • Require User Input for either dashboard prompts not BOTH ! !

    Fellow Earthlings,
    How to make required for user input for either of dashboard prompts not BOTH. !!!!!!
    Like if they enter '123' on DashP1 they need not have to enter DashP2 value and vice versa on same dashboard prompt.
    I have some dashboard prompts and I am using presentation variables to pass these values to my analysis.
    DashP1 - Pvar1 - Default All columns - User can type in values
    DashP2 - Pvar2 - Default All columns - User can type in values
    In my report , I am using a SQL filter to do a table.column_name LIKE (concat('@Pvar1}{'%')) same for the other table.column_name LIKE (concat('@Pvar2}{'%')) [ This is because users want to do a partial match on the value.
    So when the user is typing the values like 123 on DashP1 they are able to search, which is good. However on DashP2 which defaulted to all column values, they just erase/delete that and pass no value to it. So it remains the prompt vlaue is looking like -Select Value state which is not good. :(
    Now when there report is run for that DashP1 -value as '123' obviously we get no results since erasing that is causing it not to pass any value and when i check the query log it passes '@Pvar2'. This is causing no results.
    So I thought making it Required user input would resolve the issue, however the new request is to have either DashP1 or DashP2 require user input.
    Please advice if there a way to solve this problem.
    If this any way possible with Action links or any other methods.
    Any help is greatly appreciated.
    Thanks,
    VidyaS

    Hi Vidya, Please post that Script it will be quite handy for other OTN users.
    Thanks
    NK

  • Using decode in where clause with user defined function

    Hi,
    I have a below query which is failing as the function in the decode taking all cust_account_id as input parameter instead of the one which satisfies the condition in the inner query.So please provide a solution how can i pass only the selected one.
    SELECT hca.cust_account_id
    FROM hz_cust_accounts hca
    WHERE hca.org_id=FND_PROFILE.value('ORG_ID')
    AND hca.cust_account_id = (SELECT DISTINCT hcasa.cust_account_id
    FROM hz_cust_acct_sites_all hcasa
    WHERE hcasa.cust_account_id =hca.cust_account_id
    AND hca.org_id = hcasa.org_id)
    AND DECODE (hca.status , 'A', xx_ar_cust_audit_pkg.get_ship_to_order_type(hca.cust_account_id)) IS NOT NULL
    Thanks,
    Abhilash

    I'm having to guess without access to your tables, but I think changing the IN to a join should produce the same results. The JOIN should be evaluated before applying the WHERE clause, so this may resolve your problem.
    SELECT hca.cust_account_id
    FROM   hz_cust_accounts hca
           INNER JOIN hz_cust_acct_sites_all hcasa
           ON    hcasa.cust_account_id = hca.cust_account_id
           AND   hca.org_id = hcasa.org_id
    WHERE  hca.org_id = FND_PROFILE.value('ORG_ID')
    AND    DECODE (hca.status , 'A', xx_ar_cust_audit_pkg.get_ship_to_order_type(hca.cust_account_id)) IS NOT NULLAlternately, you could next part of the query and break the DECODE into the parent so it is evaluated after the inner query. This is likely uglier from a performance standpoint, though:
    SELECT cust_account_id
    FROM
    SELECT hca.cust_account_id, hca.status
    FROM   hz_cust_accounts hca
    WHERE  hca.org_id=FND_PROFILE.value('ORG_ID')
    AND    hca.cust_account_id = (SELECT DISTINCT hcasa.cust_account_id
                                  FROM   hz_cust_acct_sites_all hcasa
                                  WHERE  hcasa.cust_account_id =hca.cust_account_id
                                  AND    hca.org_id = hcasa.org_id)
    WHERE DECODE (status , 'A', xx_ar_cust_audit_pkg.get_ship_to_order_type(cust_account_id)) IS NOT NULL;

  • Where to validate user input from FPM_FORM_UIBB?

    I am supporting an ESS OVP app using WDA and FPM. 
    This question concerns validating/changing user input from an edit page entered through FPM_FORM_UIBB
    In a form, on an edit page, we wanted to mask the initially loaded value of a field with asterisks.
    I used the feeder class get_data() method to accomplish this.
    The user may then overtype the asterisks with content data.  At times, the user leaves some of the asterisks there as well.
    I want to check the contents of the inpu field, and, if needed, compress out the asterisks.
    if not inputfield co '* ' .
    translate inputfield using '* ' .
    condense inputfield NO-GAPS .
    endif .
    Where can I put this code? Or, where, generally, do you code validations of form data?
    Thanks…  
    …Mike

    Hi Mark,
    You should be able to catch the event in PROCESS_EVENT and GET_DATA. I would put the break-point in both of these methods and check for the field values and based on that decide course of action. So steps would be.
    1) Put in the break-points in the obove methods.
    2) Check the event and the field values you are intrested in.
    3) Code accordingly.
    Hope it helps.
    Laeeq Siddique

  • How can I terminate TestStand without requiring user input?

    I want to completely terminate TestStand and any running sequences. Engine.ShutDown seems to have a delay waiting for user input. Is there a function call that disregards this delay and immediately either kills all sequences or unloads them and kills TestStand?
    I am trying to do this in C++.

    To BMas05 -
    Yes if you set,
    Setting: "Exiting"
    Condition: "When Executing"
    Time Limit: "2"
    Action: "Terminate Execution"
    On shutdown, if an execution is running for more than 2 seconds after shutdown is initiated, TestStand will attempt to terminate the execution.
    Now if you wanted to escalate terminations that take too long you could additionally set,
    Setting: "Exiting"
    Condition: "When Terminating"
    Time Limit: "4"
    Action: "Abort Execution"
    So now on shutdown, if an execution is terminating for more than 4 seconds after termination is initiated on shutdown, TestStand will attempt to abort the execution.
    Now if you wanted to escalate aborting executions
    that take too long you could additionally set,
    Setting: "Exiting"
    Condition: "When Aborting"
    Time Limit: "6"
    Action: "Kill the Execution's Thread's"
    So now on shutdown, if an execution is aborting(typically unresponsive) for more than 6 seconds after abort is initiated, TestStand will attempt to kill the unresponsive thread.
    Scott Richardson (NI)
    Scott Richardson
    National Instruments

  • Where to validate user input

    hi all,
    I have following problem:
    When user submits form, all the data in request are Strings. Now suppose I need to put this data in database using TransferObject and DAO. My question is how to do it properly? I think about two ways of doing that:
    1)
    Create TransferObject with all properties being Strings or arrays of Strings, and then let DAO classes take care about validation of data format and type conversion. In this case all I need to do in my servlet is to create TransferObject, fill it with form data without any validation and then pass this object to DAO. Then DAO makes all conversions, and either adds new record or raises format exception.
    2)
    Create TransferObject with different types of properties according to database fields types. Then DAO get's valid data and all it needs to do is to put it in database. But then I have to take care about validation in my servlet to pass valid data to DAO.
    This way has at least one disadvantage for me: I think I can't use any utilities copying all properties from form to TransferObject.
    So tell me which way should be used to have right aplication design.
    Thanks for all replies.

    IMO, the database should concern itself with data integrity and referential integrity. It will validate the data type, precision and scale you are attempting to insert or update. It will also enforce referential constraints (e.g., primary keys, foreign keys, unique constraints, etc.) that may exist on the table(s). Finally, the database is responsible for ensuring a transaction is atomic, either the whole logical unit of work will be committed or the changes rolled-back successfully.
    More complex validations (e.g., account balance cannot be negative unless savings account balance is greater than $1,000) should generally be done in the middle-tier, though an argument can be made that even these validations can also be put in the database.
    Generally, for complicated transactions, the middle-tier will be responsible for transaction management. This is not a minor responsibility in a complicated set of data updates. The middle-tier will also enforce workflow and/or data sufficiency (e.g., even though a column may be nullable in the database, a business rule may require the value be specified).
    Finally, some validation can occur on the client. Though, you should always look at these validations in terms of application response time, not actual data validation. You may want to place some validations on the client so that a server trip is not required for validation. However, all validations must occur in the middle-ware and/or database. You cannot trust client code. Someone might modify the page and resubmit it.
    - Saish

  • How to validate a user input for where clause?

    I have a situation to validate a where clause which is input by the user.
    Because the query will be run against huge tables and we need to notify the user if they input the clause is not valid.
    I use the below query to try:
    Select 'A' from blablabla where user_input_where_clause and 1=0;
    however, it can not capture the error when the user input:
    'name=123' while the right condition should be name='123'.
    Can you pls advise ?

    In this particular case, Oracle will not even try to run the SQL statement because of the syntax error. IF the WHERE condition supplied does not make sense, Oracle will not execute the statement, so it does not matter if the query accesses huge tables.
    SQL> Select 'A' from blablabla where 'name=123' and 1=0 ;
    Select 'A' from blablabla where 'name=123' and 1=0
    ERROR at line 1:
    ORA-00920: invalid relational operator
    SQL>IF you have a restriction as to what type/value can user specify for the where condition (asuming it would make sense to SQL engine), you would have to do it before submitting to the database.
    Note, however, that user could specify any condition they like, having potentially damaging effects.

  • Accept user input

    Dear All,
    How do we accept user input in isql*plus in 9i? I am writing pl/sql code that requires user input but i get the message:
    SP2-0850: Command "accept" is not available in iSQL*Plus
    the figure you requested is:
    PL/SQL procedure successfully completed.

    Also you can use some commands at sqlplus to add/delete/append lines of sql buffer.
    append (a)
    insert (i)
    del (d)
    run (r)iline (l) nth line (1l or 2l ...)
    change c/<old value>/<new value>
    etc.,
    << Sample >>
    SRI>select * from bonus;
    ENAME JOB SAL COMM
    Sri DBA 1000 123
    Sam Sales 1022 10
    Elapsed: 00:00:00.00
    SRI>c/*/ename,job
    1* select ename,job from bonus
    SRI>r
    1* select ename,job from bonus
    ENAME JOB
    Sri DBA
    Sam Sales
    Elapsed: 00:00:00.01
    SRI>i
    2 where ename = 'Sri';
    ENAME JOB
    Sri DBA
    Elapsed: 00:00:00.01
    SRI>;
    1 select ename,job from bonus
    2* where ename = 'Sri'
    SRI>2
    2* where ename = 'Sri'
    SRI>DEL
    SRI>;
    1* select ename,job from bonus
    -Sri

  • Prompting user input in LabVIEW

    We've written a number of VIs that require user input, and we'd like for the user to be able to begin typing right away, rather than having to use the mouse or the Tab key to move the cursor to the first text field. What's a good way of doing this? Thank you very much.
    -Dan

    You can use the KeyFocus property node. On the block diagram, right click
    on the control and add a property node. Right click on the lower part of
    the node and change the property to KeyFocus. Wire a True boolean to the
    property.
    "Arrington" wrote in message
    news:[email protected]..
    > We've written a number of VIs that require user input, and we'd like
    > for the user to be able to begin typing right away, rather than having
    > to use the mouse or the Tab key to move the cursor to the first text
    > field. What's a good way of doing this? Thank you very much.
    > -Dan
    >

  • User Defined function in Where clause

    DB:- 11.2
    Input:- 'ACCOUNTING,SALES'
    Output:- ('ACCOUNTING','SALES')
    WITH T AS (select 'ACCOUNTING,SALES' str from dual)
    select '('||regexp_replace(str,'([[:alpha:]]+)','''\1''')||')' from t /*this works*/I've created a function to use this in a where clause
    create or replace function ss(dname varchar2)
    return varchar2 is
    begin
      RETURN '('||regexp_replace(dname,'([[:alpha:]]+)','''\1''')||')';
    end; 
    select ss('ACCOUNTING,SALES') from dual --this worksBut when I am using this function in a where clause result is not coming..any thing i am missing?
    select * from dept where dname in ss('ACCOUNTING,SALES') --no rows

    940838 wrote:
    Output:- ('ACCOUNTING','SALES')Wrong. ('ACCOUNTING','SALES') is a list of two strings 'ACCOUNTING' and 'SALES' while your function returns a single string '(''ACCOUNTING'',''SALES'')'.
    IN clause requires a comma-separated list of values while your function, again, returns just one value. So query is comparing 'SALES' whith '(''ACCOUNTING'',''SALES'')', not with ('ACCOUNTING','SALES') and obviously no match. What you are trying to do is called dynamic SQL. There are plenty examples on how to use it. But you don't need it. Use nested table or varray. I'll use Oracle supplied varray type sys.OdciVarchar2List:
    select  *
      from  dept
      where dname in (
                      select  *
                        from  table(sys.OdciVarchar2List('ACCOUNTING','SALES'))
        DEPTNO DNAME          LOC
            10 ACCOUNTING     NEW YORK
            30 SALES          CHICAGO
    SQL>SY.

  • SQL- 2005 : User Input in select statement's where cond [Input Parameter]

    Hi All
    i am using SQL Server 2005 , i want to select the data based on the user input in where condition,
    but i am not sure what to give in where condition,can anyone have any idea on this
    SELECT [NO]
          ,[NAME]
          ,[PAGE_COUNT]
      FROM [DS].[DB].[tablename]
    where [NO]=???
    Regards
    Chaitanya.A

    HI
    public String getEmployeeName(String employeeNumber)
              // TODO : Implement
              String name = new String();
              String exception = new String();
              try
              InitialContext initialContext = new InitialContext();
              DataSource dataSource =(DataSource) initialContext.lookup("jdbc/XXXX");
              java.sql.Connection connection = dataSource.getConnection();
              PreparedStatement stmt =connection.prepareStatement("SELECT [NAME]FROM [XXX].[ASDF].[ABCD] where [NO]=?");
              stmt.setString(1,employeeNumber);
              ResultSet result = stmt.executeQuery();
              while (result.next())
                   name = result.getString("Name");
                   connection.close();
                   return name;
              catch (Exception e)
                   exception = "Exception";
                   return exception;
    i used the above function to achieve my requirement
    Thanks
    Chaitanya.A

  • Input xml  to where clause ..

    An input XML passed as a parameter to the oracle stored procedure . based on input xml the dynamic predicate( where ) clause need to be build . for example
    <map opt="and" >
    <map opt="and" >
    <condition opt="equal" >
         <key>job_id</key>
         <value>IT_PROG</value>
    </condition>
    <conditon opt="equal" >
              <key>salary</key>
              <value>9000</value>
    </conditon>
    </map>
    <map opt="or" >
    <condition opt="equal" >
              <key>manger_id</key>
              <value>100</value>
    </condition>
    <conditon opt="like" >
                   <key>lastname</key>
                   <value>m</value>
    </conditon>
    </map>
    </map>
    select * from employees where (job_id='IT_PROG' and salary='9000') or (manager_id = '100' or last_name like '%m%').
    please help with pl/sql part of this . i have written a pl/sql which can print the element tag , what changes should i make this code .
    The input xml will be dynamic based on the input xml the predicate should be prepared, i want to use oracle dom .
    declare
    vxml xmltype;
    l_xmldoc xmldom.DOMDocument;
    l_ndlist xmldom.DOMNodeList;
    l_node xmldom.DOMNode;
    l_element xmldom.DOMElement;
    len number;
    BEGIN
    vxml:= xmltype('<map opt="and" >
    <map opt="and" >
    <condition opt="equal" >
         <key>job_id</key>
         <value>IT_PROG</value>
    </condition>
    <conditon opt="equal" >
              <key>salary</key>
              <value>9000</value>
    </conditon>
    </map>
    <map opt="or" >
    <condition opt="equal" >
              <key>manger_id</key>
              <value>100</value>
    </condition>
    <conditon opt="like" >
                   <key>lastname</key>
                   <value>m</value>
    </conditon>
    </map>
    </map>
    l_xmldoc := xmldom.newDOMDocument(vxml);
    l_ndlist := xmldom.getElementsByTagName(l_xmldoc, '*');
    len := xmldom.getLength(l_ndlist);
    -- loop through elements
    for i in 1..len-1 loop
    l_node := xmldom.item(l_ndlist, i);
    dbms_output.put( xmldom.getNodeName(l_node));
    l_node := xmldom.getFirstChild(l_node);
    if xmldom.getNodeType(l_node) = xmldom.TEXT_NODE then
    dbms_output.put('='|| xmldom.getNodeValue(l_node) || ' ');
    end if;
    dbms_output.put(' ');
    end loop;
    dbms_output.put_line('');
    END;

    >
    our application has java front end , the users have option to select multiple filter values . the frond end developers will send an xml construct as the one i have showed . based on the input xml i have to apply those filters on a table . so i thought using xml dom and parse the xml and make a dynamic sql from that .
    >
    why java app needs to send XML? Let it create SQL and execute it.
    Of course you can do it in PL/SQL but it less convenient comparing to Java.
    If you can extract values from XML, then just create SQL for them, assign bind vars and execute it dynamically.
    Yes, you will have to implement lots of IF logic.
    Advise: Use bind variables as placeholders for values to avoid injection attacks. Do not concatenate values into your dynamic SQL.

  • Strange errors when using user defined function in where clause

    Hello,
    I am having trouble with a function that, when used in the where clause of a select will cause an error if the first column selected is of type INTEGER. Not sure whether I am doing something wrong or whether this is a bug.
    Here is a very simple test case:
    create table test(
    col1 integer not null,
    col2 varchar(20) ascii default ''
    insert into test values(1,'2011-03-15 05:00:00')
    insert into test values(2,'2011-03-15 07:00:00')
    CREATE FUNCTION BTR_TAG  RETURNS VARCHAR AS
        VAR ret VARCHAR(20);
      SET ret='2011-03-15 06:00:00';
      RETURN ret;
    Select * from test where col2 >= BTR_TAG()
    Select col1,col2 from test where col2 >= BTR_TAG()
    =>  Error in assignment;-3016 POS(1) Invalid numeric constant
    Select '',* from test where col2 >= BTR_TAG()
    Select col2,col1 from test where col2 >= BTR_TAG()
    => works as it should
    MaxDB V 7.7.07.16 running on Windows Server 2003
    I can replicated the test case above with Sql Studio and other ODBC based tools.
    Thanks in advance,
    Silke Arnswald

    Hello Siva,
    sorry, but I don't understand your reply:
    This is not right forum to posting this question.
    You are from which module or working any 3rd party application.
    MaxDB 7.7.07.16 is the community version of MaxDb,
    we are not using it for SAP
    and no 3rd party software is required to reproduce my problem,
    Sql Studio or Database Studio will do.
    Regards,
    Silke Arnswald

  • Using user defined function in where clause

    Hi,
    I have defined function to get maximum date before passed date on the table 'A' and I'm using the same function to get details on that date from the same table 'A' in where clause.
    for ex:
    SELECT x,y,z
    FROM A
    WHREE a.date = max_date;
    But on one database instance it is running fine and on other it is going in a infinite loop.
    Pls help me out
    Thanks in advance,
    Prashant

    Hello Siva,
    sorry, but I don't understand your reply:
    This is not right forum to posting this question.
    You are from which module or working any 3rd party application.
    MaxDB 7.7.07.16 is the community version of MaxDb,
    we are not using it for SAP
    and no 3rd party software is required to reproduce my problem,
    Sql Studio or Database Studio will do.
    Regards,
    Silke Arnswald

Maybe you are looking for