Checking dynamic query at run time

i need to check whether the query is valid or not at run time. The query will be formed based on the column name, table name, and where clause. this query is purely a select statement. if column name and table names are diff then system should display an error msg. i have more than 10 tables and the table name will be selected from LOV. i should be allowed to enter the condition for where clause also ar run time and this condition column should also be validated.

Hi,
I think you only want to see if your select statement has compilation error or not because when you use dynamic statement it doesnt show the compilation erro if the statement has it or not. What you can do is add an item say "stmt" in your control block. change the property to multi record so that you can see multiple lines in that item and make the lenght say 2000. Now assign your statement into "stmt" for example
:control_block.stmt := 'select ' || col1
                    || ','
                    || col2
                    || ','
                    || col3
                    || ' FROM '
                    || table
                    || ' where ' || conditionput this statement on any button on when-button-pressed trigger. When you will press the button on run time you will see the statement. Run that statement on sql*plus or toad and check if there is any problem in the statement.
Hope this helps
Ghulam

Similar Messages

  • Dynamic Query at Run time

    Hi,
    Happy New Year!!
    I am having some problem
    Split table details
    startid, endid
    1,1
    2,2
    3,4
    expected output is 1,2,34
    Begin
    P_blob v_local varchar2(1800) ='1234';
    select listagg(COLUMN_NAME, ',') within group (order by column_id) INTO Column_name
    from user_tab_columns where table_name= upper('mytable' );
    select listagg(column_id, ',') within group (order by column_id) INTO Column_id
    from user_tab_columns where table_name= upper('mytable' );
    insert into myewtable ('|| Column_name || ')
    with t1 as( select '''|| P_blob || ''' str from dual),
    t2 as( Select startid, endid from Split),
    t3 as
    ( select str,startid s,endid e, row_number() over(order by startid) rn from t1,t2)
    select * from t3 pivot
    max(substr(str,s,e)) str for rn in ('|| Column_id || ')
    end;
    how so i represent the Column_name as column values here.
    Query should be
    insert into myewtable ('col1,col2,col3 ')
    with t1 as( select '''|| P_blob || ''' str from dual),
    t2 as( Select startid, endid from Split),
    t3 as
    ( select str,startid s,endid e, row_number() over(order by startid) rn from t1,t2)
    select * from t3 pivot
    max(substr(str,s,e)) str for rn in ('1,2,3')
    end;
    i am getting as Column_name ,Column_id.
    how to represent the column values inside the query.
    Thanks

    Can you please check if this suffices your requirement. (I extended few testcases)
    WITH t AS
            (SELECT 1 startid, 1 endid FROM DUAL
             UNION ALL
             SELECT 2, 2 FROM DUAL
             UNION ALL
             SELECT 3, 4 FROM DUAL
             union all
             select 9,9 from dual
             union all
             select 1,5 from dual)
    SELECT listagg (DECODE (startid, endid, endid, startid || endid), ',')
              WITHIN GROUP (ORDER BY 1) finstr
      FROM t;output
    FINSTR
    1,15,2,34,9Cheers,
    Manik.

  • Check marks or dynamic items for run-time shortcut menus

    Labview version: 8.0
    I'd like to create a run-time shortcut menu for my Xcontrol, that would
    allow user to toggle between two states of the control. Is it possible
    to either
    1) dynamically apply check marks to run-time shortcut menus or
    2) dynamically modify the run-time shortcut menu content
    Tomi
    Tomi Maila

    Hi Tomi,
    Great question.  Yes, you can do what you want with run-time shortcut menus in LabVIEW 8.0.  If you want to dynamically modify the menu content, you have to do it in the "Shortcut Menu Activation?" event in the facade VI of the XControl.  In the event data for this event is a parameter called "MenuRef" which works with the same menu primitives that have been around since LabVIEW 5 for editing the menu bar at run-time. 
    With these primitives, you can add/delete/modify menu items to the shortcut menu.  The items that are already in the MenuRef when this event case executes are always the ones that are statically defined, either by LabVIEW or by customizing them.  You do not have control over the state of the items that LabVIEW adds, but you can remove them and add ones with the same text (just with a different tag).  In your case, you would probably want to use the Insert Menu Item primitive to add an item such as "Toggle State".  Give it a tag such as "USER_TOGGLE_STATE".  Then you'll want to use the Set Menu Item Info primitive to set the checkmark for that item based on the state of the XControl.
    Then, you'll need to add an event case for the "Shortcut Menu Selection (User)" event so you can handle the item being selected.  Wire the Item Tag parameter from the event data to a case structure and add a case to look for "USER_TOGGLE_STATE".  And in that case, toggle the state of your XControl.  That's all you need to do!
    The Dual Mode Thermomter shipping example in <LabVIEW 8.0>\examples\general\xcontrols\Dual Mode Thermometer\Simple Dual Mode Thermometer XControl.lvproj is a simple example of how you can modify the menu and respond to the items selected.  It's a little different than what you want to do, but it might help you to look at it.
    Good luck!  Let me know if you have questions.
    Robbie

  • Dynamic table in Run time

    Hi,
    I need to create a dynamic table in run time
    Input from user will be like
    Param1---->'tablename'
    Param2---->'col1name datatype,col2name datatype,col3name datatype,col4name datatype,col5name datatype,col6name datatype........................'
    Param3---->returnCode OUT NUMBER
    Param4---->errorMessage OUT VARCHAR2
    how to write a script to execute the above statement.
    The input will be from java page, it has connection string of the database
    Thanks!

    After remove *:*
    Error report:
    ORA-06550: line 4, column 6:
    PLS-00103: Encountered the symbol "CREATE_TABLE" when expecting one of the following:
    := . ( @ % ;
    The symbol ":=" was substituted for "CREATE_TABLE" to continue.
    06550. 00000 - "line %s, column %s:\n%s"
    *Cause:    Usually a PL/SQL compilation error.
    *Action:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to set vo query at run time

    Hi,
    Is it possible to bind the where clause of query at run time.
    N :)

    Hi,
    Yes its possible.
    To add new where clause to your query.
    vo.setWhereClause(null);//If you want to remove any existing programmatically added where clause.
    vo.setWhereClause("Your new query");
    To bind varibales (Say there are 2 bind variables),
    First way to achieve this.
    setWhereClauseParam(null); //Always reset it to remove existing bindings)
    setWhereClauseParam(0, "Your first paramter value"); // Second parameter "Your first paramter value" is of type object.
    setWhereClauseParam(1, "Your first paramter value");
    In case you use "?" styly type binding, this count in above method starts with 1 instead of 0.
    Second way is to put all bind variables in an object array and pass to above method.
    Vector params=new Vector(2);
    params.addElement("FirstParameter");
    params.addElement("SecondParameter");
    Now call vo.executeQuery() to fetch the results as per new query.
    Abdul Wahid

  • How to get report (SQL Query) generating Run Time

    There is a Standard report of Payroll which show employee transfer information on the bases of location, grade job or organization, now to get actual query which is generated by run time in report builder including whether single column parameter or lexical parameter " because currently the query in not complicate but the parameter and lexical parameter is much more due to this not quite easy to under stand just copy past it into toad or pl/sql developer,
    Kindly share your experience to get such kind of query in you working time.
    thanks

    Here i try to explain contain of query.
    Parameter
    P_DEPTNO = 10
    P_WHERE_CLAUSE := ' AND EMPNO IS NOT NULL AND SALARY > 100'
    SELECT * FROM EMP
    WHERE DEPTNO = P_DEPTNO
    &P_WHERE_CLAUSE
    REPROT WILL GENERATE QUERY AT RUN TIME IS LIKE THAT
    SELECT * FROM EMP
    WHERE DEPTNO = 10
    AND EMPNO IS NOT NULL AND SALARY > 100
    Now i want to get this query out(Run time) by doing any oracle database feature or sth similar.
    thanks

  • BEx Query designer : Run-time error '457'

    Hey,
    We installed the standard query's for HR.  When we try to change the query 'Average age of employees', and we try to restrict on 'Calender year/month' then we receive this error. 
    Run-time error '457' : This key is already associated with an element of this collection.
    We're using version 3.50.
    I already saw oss note 517232 but that was for version 2.0 and not intresting for my case...  Anybody any idea? 
    Kind regards,
    Tom
    PS : I also saw : https://forums.sdn.sap.com/click.jspa?searchID=1049118&messageID=1649858 & https://forums.sdn.sap.com/click.jspa?searchID=1049118&messageID=2243413

    Hi,
    Check this conditions as I haven't checked the queries ......make sure that these two conditions are not getting into picture after you make the changes to the query.
    1) When we are making restricted key figures we can’t use same variable to restrict to two different Characteristics in the same RKF.
    2)Once a Variable used to restrict a characteristic in one RKF you cannot use it to restrict it other characteristic in other key figures i.e.  You can use it to restrict that particular characteristic only in other key figures.
    Hope it helps
    Thanks

  • Dashboard to BEx query call run time very slow (7-8 mins)

    Hi Guys,
    I am currently working on a project where BEx query is being consumed using BICS. The functional team has built a BEx which is being cached in Webi by the BO developer and then that cashed Webi is being used in Dashboard. We have many hierarchies (Fund Center, Profit Center, GL Account etc.) used in the dashboard.
    BEx query > WEBi (Cached) > Dashboard
    Clicking the main level in hierarchy in dashboard the data comes back in 2-3 secs as the data is cached in Webi
    ISSUE: In Dashboard based on where user is on the Fund Center hierarchy there is a button called “Summary Report” on the dashboard which calls the BEx query and that second call takes roughly about 7-8 minutes. How could we reduce the run time of the second query?
    The secondary query uses the same data set as the first one but as the data is cached in Webi and it uses Web services to pass data to dashboard, so any call back from dashboard to the cached webi the hierarchy information is lost  and thus the secondary query call to BEx query.
    Would it be possible to recommend any solution where we could bring the run time of the secondary call to less than a minute?
    Thanks,
    Keys

    First update to current frontend patch. many correction are included.
    Further check these notes: (relavant only if Analyzer is culprit)
    1160093: REPAIR MODE - Prog error/performance problems when using large workbooks
    1289127: REPAIR MODE - BExAnalyzer: performance issue applying styles in Excel 2007
    1293255: REPAIR MODE - BExAnalyzer: crash when repairing workbook with Excel 2007
    1150242+1094799: ANA_USE_SIDGRID - Improving performance/memory in the BEx Analyzer
    1179647: ANA_USE_TABLE - Performance: Network load in BEx Analyzer
    1260213: ANA_USE_OPTIMIZE_STG - Performance problems during workbook opening in Excel 2007
    1287179: ANA_SINGLEDPREFRESH - Single Data Provider Refresh
    1286653: Performance issues while displaying hierarchy (especially in Excel 2007)
    1352375: ANA_USE_SIDGRIDWBUF / ANA_USE_SIDGRIDMASS Performance improvements in a WAN (roundtrip reductions)
    1373214: Workbook compression
    1392745: ANA_CACHE_WORKBOOK - Workbook caching

  • Error 1003 when loading a VI dynamically on LabView Run-time ini file configuration

    hi all,
    I have a problem with my runtime excutable.
    On 4 systems, all running XP it runs fine.
    On 2 systems ( one a new install of just LVRT 2011 SP1 ) I have:
    Error 1003 when loading a VI dynamically on LabView Real-time
    Or more spoecifically the error code is 1003 and the error source is Open VI Reference.
    When the RT app runs correctly I get these paths:
    Path Sent to Open Vi Reference:              Yeast_Grower.exe\Tecan_talk_Control.vi, 
    Path Returned from Open Vi Refence:       C:\Program Files\Yeast_Grower\Yeast_Grower.exe\Tecan_talk_Control.vi, 
    On a system that does gets the 1003 Open Vi Refence error I have the same Path Sent but of course no path returned as it does not open.
    To be sure that the vi Dyanmically called vi is compiled and valid at runtime I also include a copy of in the main.vi.
    To be extra sure I have also installed the runtime versions of VISA and DAQmx.
    I have compiled it with and without the "Use LV 8 calling hiaracy"
    My conclusion as this stage is that either the installation of LVRT 2011SP1 misses something the earlier LVRT installtions make.
    or is there a MyApp.ini or LVRT .ini  that controls how the RT dyanim calls are handled.
    Help very welcome how to solve this puzzle.
    thanks
    michael

    I understand that all the PCs (6 of them) have LV 2011 SP1, runtime or the development system installed. Right?
    How many of these PCs have the source code available on them?
    -> Only one of them has the source code.
    I am not sure I understood 'I also include a copy of in the main.vi'. Does it mean you placed the subvi in the main.vi?
    -> I meant I have included in main.vi the actual vi that is called dynamically - but only where it is not called.
    Did you try including the sub vi which is called dynamically, as 'Always included' in the EXE build?
    -> No, I did not know of this option - but the above I did this by default.
    Edit: Did you verify the software versions of LV RT, VISA etc on all the PCs? Are they same?
    -> I did verify even added DAQmx just in case
    There is lots of material available on this forum for error 1003 and dynamic vi calling. Did you find anything useful to try among the forums threads?
    -> I did view many of them.
    I did finally find the answer.  
    I have a subvi (callNet.vi ) in the dynamically called vi (dynamic ) that calls .Net libraries.
    Now the thing is that this subvi callNet.vi is coded out by enclosing it in a Disable structure.
    In fact this subvi ( callNet.vi) does not even compile - ie it has a broken arrow
    however if enclosed in a Disabled structure and disabled, the enclosing vi compiles OK.
    However I have discovered that even with the .Net calling subvi (callNet.vi) in the Disabled state of the Disabled structure
    the enclosing vi (dynamic.vi ) does NOT run - although it compiles just fine.
    Once I installed the .Net libraries (I actually did include them with my app installer ) with the vender's supplied installer
    then my app now successfully calls the dynamic vi.
    So the Summary and warning is:  Even if the dynamic called vi is included in Main.vi and Main.exe runs ( but does not call the dynamic vi - except when called dynamically at later some point ) and even if, in this case, the .Net calling subvi is disabled out ie no .Net calls are made the dynamically called vi will not run when called dynamically.
    I hope that is not too confusing.  In summary it seems the Disable structure does not entirely disable.
    Michael

  • Can we create items dynamically or at run time?

    Hello expert,
    can we create some item dynamically at some button click?
    Thanks
    yash

    yash_08031983 wrote:
    Hello expert,
    can we create some item dynamically at some button click?Hello, yash
    You can not create items at run time. But you can manage them at run time by setting Visible property programatically.
    Hope this helps..
    Hamid

  • Check marks on custom run-time menus

    Is there a simple way to add a check mark for currently selected item on custom run-time menus?  
    The only method I have found is to fire off of the "Shortcut Menu Activation?" event, grab the menu reference, and basically recreate the shortcut menu with the proper check marks based on boolean values.  This method just seems ... cumbersome for something that should (in theory) be fairly common. I can't help but think there is a better solution.
    Thanks!
    Solved!
    Go to Solution.

    Hi Bown,
    you can assign custom menus with the menu editor to your controls/VIs. They will be saved as rtm file.
    Using the known tag names of such custom menus you can set the checkmark for your tags without rebuilding the menu on activation each time…
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • How to find Query with Running time

    dear frnds,
    I need to find the query details and query execution time from a DB USER. am using oracle 11g. how to generate this report
    please give me any idea.,
    thanks.
    Edited by: Velsjeya on May 14, 2012 1:07 AM
    Edited by: Velsjeya on May 14, 2012 1:07 AM

    Velsjeya wrote:
    thanks a lot,
    here i need to show query running time also...( how many mins that particular query ran) ... please help mePlease do search for the question's answer. V$SQL should be able to show you what you are looking for. Asktom's thread given below discusses the same,
    http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:912859800346801944
    Aman....

  • Dynamic Images at run-time

    I have a report that I would like to display a different
    image/logo depending on the user who is generating the report. Is
    there a method to display a different image at run-time? Or, does
    anyone have a better way rather than cloning 10 versions of the
    report will a different image on each?
    Thanks for any help in advance,
    Kevin

    Here is a sample that shows changing an image at runtime. If you are using a different version of Crystal Reports than XI R2, let me know.
    https://boc.sdn.sap.com/node/6174
    Cheers,
    Jonathan

  • Can't create dynamic query that runs!

    Hi all,
    I am attempting to create a dynamic query to go against my Oracle Db with preparedstatement. I tried many other ways also and have exhausted everything I can think of or find. My query works when I put it together with a text editor after it has been output by my program, but won't work as is. It seems like it is splitting it up somehow.
    Here is the code...Is there any way to get this query together?
    Object objectName1 = (String) rapArray.get(0);
    StringBuffer query = new StringBuffer("SELECT end_phrase FROM rap_lines WHERE start_phrase IN ");
    String teststring = objectName1.toString();
    query.append("('" + teststring + "'");
    for (int i=1; i < initArraySize; i++){
    objectName1 = (String) rapArray.get(i);
    teststring = objectName1.toString();
    ********the problem somehow seems to lie HERE where the file is separating just after "teststring" is added********
    query.append(", '" + teststring + "'");
    query.append(")");
    System.out.println(query);
    ResultSet rs = stmt.executeQuery(new String(query));
    returnArray = new ArrayList();
    while (rs.next()) {
    s = rs.getString("end_phrase");
    System.out.println(s);
    Here is the query it outpus and how it seems to be separated...when put together, it works fine.
    SELECT end_phrase FROM rap_lines WHERE start_phrase IN ('Your Pops caught you smoking and he said NO WAY!
    ', 'Its getting hot in here.
    ', 'Im the cream of the crop. I rise to the top.', 'WHA?
    ', 'Youz a big fine woman.
    ', 'That car dont come out till next year!
    ', '$80,000 plus CHROME!
    ', 'Sippin on gin and juice. Laid Back
    ', 'All I wanna do is a zoom zoom zoom and a boom boom!
    ', 'Rollin in my six-fo...')

    Hi.
    The only possibility that I can see here is that the Strings in rapArray have return characters at the end.
    Once you've solved that, here are two miscellaneous pieces of advice:
    1. The value of objectName1 is always a reference to a String. So, declare objectName1 a String. Also, don't do objectName1.toString() - this has no effect except for making the code a little more difficult to read. When you've done these things, you'll probably find the need for testString disappears.
    2. There is a special markuo to put around code when submitting it to the forums. See the 'code' markup at http://forum.java.sun.com/faq.jsp#messageformat
    Regards,
    Lance
    Lance Walton - [email protected]
    Team In A Box - Software without Tragedy
    http://www.teaminabox.co.uk

  • How to get the name of an executing ABAP query in run time

    Hi ABAP Gurus,
    I need to get the ABAP query name when it's running. For example we can get the current executing ABAP program name from SY-REPID.
    My tried logic - every query generates an ABAP program like AQZZUGQUERY. 'UG' stands for user-group name and the length specified for it is 12, if the length of the user-group name is less than 12, then the rest will be filled by '='. Next 'QUERY' stands for ABAP query name and the length specified for it is 14, if less, then the rest will be filled in with '=' in the right. I've tried to extract the query name by using cut and trip (offset) operations.
    But somehow this logic is not working - always it's picking up the function name as checked in debug mode.
    Guys - Can you please provide me the solution on this.
    Thanks & regards,
    Jayanta Bej.

    Guys,
    I've cracked the issue. Instead of retrieving the query name from sy-repid, I've retrieved it from sy-cprog and the problem is resolved.
    Thanks guys for your quick responses.
    Thanks and regards,
    Jayanta Bej.

Maybe you are looking for

  • Error while upgrading Patch SAPKB70014- Error R3trans received signal 11

    Dear All while updating my basis patch level to sapkb70014 I m facing the error at DDIC import phase related to R3trans recived signal 11.My tp version is accurate as required . Kernel versin is 238 Can you guys help me to solve the same Regards Shil

  • How can I get a passage highlighted in yellow in a word document sent to Adobe Reader?

    How can I get a passage highlighted in yellow in a word document sent to Adobe Reader?

  • Email Address Woes

    I often try try to enter someone in my comcast address book on a new email and my iPad doesn't seem to find the address, although it IS in the address book. They set up the email at the Santa Rosa, ca apple store. I have now re entered many of the ad

  • UP DATE ASKING REMOVE OLD PACKAGE INTELL PROSET WIRELESS WIFI WINDOW 7 .

    .Can not uninstall intell proset wireless give code ERROR 1721BTHEREIS A PROBLEM WITH THIS WINDOWS INSTALLER PACKAGE . A PROGRAM REQUIRED FOR THIS INSTALL TO COMPLETE COULD NOT BE RUN. CONTACT YOUR SUPPORT PESONNEL OR PACKAGE VENDOR. ACTION: UNINSTAL

  • Cannot add users to roles

    I have configured OpenLDAP data store with Access Manager. I can see the users added in LDAP in the Subjects tab of Access Manager, but when I create a role ad try to add users in the role I get the exception Plug-in com.sun.identity.idm.plugins.file