Error on execution of an sql query

hello,
i'm using ms access database and i'm trying to retreive data from it,
i'm using sql queries and it work well, but my last quesry won't execute and i got an error message sql exception error "invalid handle"
here's my code
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String filename = "C:/base.mdb";
String database = "jdbc:odbcriver={Microsoft Access Driver (*.mdb)};DBQ=";
database += filename.trim() + ";DriverID=22;READONLY=true}";
Connection con = DriverManager.getConnection(database, "", "");
Statement s = con.createStatement();
s.execute("select * from domaine");
ResultSet rs0 = s.getResultSet();
if (rs0 != null) // if rs == null, then there is no ResultSet to view
while ( rs0.next() ){
jComboDomaine.addItem(rs0.getString(2));}
s.execute("select * from population");
ResultSet rs1 = s.getResultSet();
if (rs1 != null) // if rs == null, then there is no ResultSet to view
while ( rs1.next() )
{jComboPopulation.addItem(rs1.getString(2));}
s.execute("select * from Spopulation");
ResultSet rs2 = s.getResultSet();
if (rs2 != null) // if rs == null, then there is no ResultSet to view
while ( rs2.next() )
{jComboSpopulation.addItem(rs2.getString(3));}
s.execute("select id_cas,TitreCas from CasN2");
ResultSet rs3 = s.getResultSet();
if (rs3 != null) // if rs == null, then there is no ResultSet to viewew
while ( rs3.next() )
{ cache.add (rs3.getString(2));
cache_Id.add (rs3.getString(1));
jListCas = new JList(cache);
new View1(jComboPopulation,jComboSpopulation,jComboDomaine,jListCas,jListSolution,s,cache,cache_Id);
main
public Vector action(int c){
System.out.println("OK");
Vector temp = new Vector();
try{
s.execute("select DescriptionS from CasN2 where Id_cas= ' 120 '");
ResultSet rs4 = s.getResultSet();
temp.addElement(rs4.getString(1));
catch (Exception e) {
System.out.println("Error: " + e);
return temp;
thank you.

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String filename = "C:/base.mdb";
String database = "jdbc:odbcriver={Microsoft Access Driver (*.mdb)};DBQ=";
database += filename.trim() + ";DriverID=22;READONLY=true}";
Connection con = DriverManager.getConnection(database, "", "");
Statement s = con.createStatement();
s.execute("select * from domaine");
ResultSet rs0 = s.getResultSet();
if (rs0 != null) // if rs == null, then there is no ResultSet to view
while ( rs0.next() ){
jComboDomaine.addItem(rs0.getString(2));}
s.execute("select * from population");
ResultSet rs1 = s.getResultSet();
if (rs1 != null) // if rs == null, then there is no ResultSet to view
while ( rs1.next() )
{jComboPopulation.addItem(rs1.getString(2));}
s.execute("select * from Spopulation");
ResultSet rs2 = s.getResultSet();
if (rs2 != null) // if rs == null, then there is no ResultSet to view
while ( rs2.next() )
{jComboSpopulation.addItem(rs2.getString(3));}
s.execute("select id_cas,TitreCas from CasN2");
ResultSet rs3 = s.getResultSet();
if (rs3 != null) // if rs == null, then there is no ResultSet to viewew
while ( rs3.next() )
{ cache.add (rs3.getString(2));
cache_Id.add (rs3.getString(1));
jListCas = new JList(cache);
new View1(jComboPopulation,jComboSpopulation,jComboDomaine,jListCas,jListSolution,s,cache,cache_Id);
main
public Vector action(int c){
System.out.println("OK");
Vector temp = new Vector();
try{
s.execute("select DescriptionS from CasN2 where Id_cas= ' 120 '");
ResultSet rs4 = s.getResultSet(); /* HERE'S THE ERROR */
temp.addElement(rs4.getString(1));
catch (Exception e) {
System.out.println("Error: " + e);
return temp;
} and here is the PrintStackTrace
java.sql.SQLException: Invalid handle
     at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7130)
     at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:3111)
     at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:338)
     at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(JdbcOdbcStatement.java:253)
     at data.Frame1.valueChanged(Frame1.java:147)
     at javax.swing.JList.fireSelectionValueChanged(JList.java:1317)
     at javax.swing.JList$ListSelectionHandler.valueChanged(JList.java:1331)
     at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:187) 120
     at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:157)
     at javax.swing.DefaultListSelectionModel.setValueIsAdjusting(DefaultListSelectionModel.java:619)
     at javax.swing.JList.setValueIsAdjusting(JList.java:1671)
     at javax.swing.plaf.basic.BasicListUI$Handler.mouseReleased(BasicListUI.java:2348)
     at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:232)
     at java.awt.Component.processMouseEvent(Component.java:5488)
     at javax.swing.JComponent.processMouseEvent(JComponent.java:3093)
     at java.awt.Component.processEvent(Component.java:5253)
     at java.awt.Container.processEvent(Container.java:1966)
     at java.awt.Component.dispatchEventImpl(Component.java:3955)
     at java.awt.Container.dispatchEventImpl(Container.java:2024)
     at java.awt.Component.dispatchEvent(Component.java:3803)
     at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
     at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
     at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
     at java.awt.Container.dispatchEventImpl(Container.java:2010)
     at java.awt.Window.dispatchEventImpl(Window.java:1774)
     at java.awt.Component.dispatchEvent(Component.java:3803)
     at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
     at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
     at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
     at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

Similar Messages

  • Getting zero-sized reply error when running report from SQL query

    Hi,
    I have a Report from SQL Query in Portal. When I select Excel in Output Format and then run the report, it works properly, but when I select HTML in Output Format, the report works if the rows returned are not so many (I've been able to display the report for up to 701 rows), but when I try selecting a value from the LOV that selects many rows, I get the following error:
    ERROR
    The requested URL could not be retrieved
    While trying to retrieve the URL: <data suppressed>
    The following error was encountered:
    Zero Sized Reply
    Squid did not receive any data for this request.
    Any ideas on how to fix this? Why does the number of rows returned affect the report this way?
    Thanks,
    Lorena

    Problem comes when any of the filter is applied in any one of the cases selected from the GUI.Do you mean that the problems only shows when you run the report in your browser via 9iAS?
    Which version are you using?
    Can you post the before report trigger?

  • Execution time of sql query differing a lot between two computer

    hi
    execution time of a query in my computer and more than 30 different computer is less than one second but on one of our
    customers' computers, execution time is more than ten minute. databases and data and queries are same. i re-install sql but problem remains. my sql is ms sql 2008 r2.
    any one has idea for this problem?

    Hi mahdi,
    Obviously, we can't get enough information to help you troubleshoot this issue. So, please elaborate your issue with more detail so that the community members can help you in more effecient manner.
    In addition, here is a good article regarding checklist for analyzing Slow-Running queries. Please see:
    http://technet.microsoft.com/en-us/library/ms177500(v=sql.105).aspx
    And SQL Server Profiler and Performance Monitor are good tools to troubleshoot performance issue, please see:
    Correlating SQL Server Profiler with Performance Monitor:
    https://www.simple-talk.com/sql/database-administration/correlating-sql-server-profiler-with-performance-monitor/
    Regards,
    Elvis Long
    TechNet Community Support

  • Error using Database addons with SQL query.

    I get a LabVIEW error when I provide the following SQL query to the NI database VI: ..vi.lib\addons\database\Connection.llb\Conn Execute.vi. 
    declare @SR_ID table ( script_result_id uniqueidentifier )
    insert into @SR_ID
    select script_result_id from SCRIPT_RESULT
    where script_result.software_name = '%s'
    SELECT distinct STEP_RESULT.STEP_TYPE
    FROM STEP_RESULT INNER JOIN @SR_ID s ON
    STEP_RESULT.SCRIPT_RESULT_ID = s.script_result_id
    The error is:
    Error -2146824584 occurred at NI_Database_API.lvlib:Rec Destroy - Connection.vi->Database_Query Database with flattened string reply.vi->ADUTS-RPT Query DB.vi->ADUTS-RPT Get Step Names.vi->ADUTS-RPT Top.vi
    Possible Reason(s): Exception occured in ADODB.Recordset: Operation is not allowed when the object is closed.
    The query works fine when given directly to my SQL server.
    Any ideas on this problem would be most appreciated.

    It looks like the bug is related to ADODB objects. I found a related KnowledgeBase article that was written about the same issue, but never published for some reason. Here's what it has to say about your error:
    "This error occurs when a query is run on the database that does not return any recordset data, such as a delete command.  In this case, when you encounter the DB Tools Fetch Recordset Data VI, the state of the recordset is "closed" and produces the error.
    To avoid the error, you can check for the state of the recordset and make sure that it isn't closed. To do this, use the DB Tools Get Properties VI and check the state from the properties cluster.  An additional, or alternate, check would be to check for the beginning of file and end of file properties.  If both BOF and EOF are both true, there is no data in the recordset.  
    If you open the example program, Database Fetching, you can see that they are using both of these checks.
    In versions of the toolset prior to version 1.0.2, these checks were built in.  This causes code without the checks to return this error if the toolset is updated from a previous version."
    Tim W.
    Applications Engineering
    National Instruments
    http://www.ni.com/support 

  • How to reduce execution time of SQL Query

    hi ,
    i'm working on oracle ERP application i wanna to create an OAF page that shows some data on tables .
    i've wirte the query but it take long time . .
    any body can help :
    SELECT *
    FROM (SELECT person_id,
    transaction_id,
    segment1 AS TA_number,
    segment9 AS Travel_Distination,
    SUBSTR (segment5, 0, 10) AS Travel_Date,
    creation_date AS request_date,
    status,
    full_name AS Current_Approver
    FROM ( (SELECT PPF.PERSON_ID,
    ht.TRANSACTION_ID,
    pac.segment1,
    pac.segment2,
    pac.segment3,
    pac.segment4,
    pac.segment5,
    pac.segment6,
    pac.segment7,
    pac.segment8,
    pac.segment9,
    pac.creation_date,
    DECODE (al.approval_status,
    NULL, 'Pending For Approval',
    'APPROVE', 'Finally Approved',
    al.approval_status)
    status,
    al.order_number,
    almin.order_number approver_order,
    ppf2.full_name
    FROM HR_API_TRANSACTION_Values htv,
    HR_API_TRANSACTIONS ht,
    HR_API_TRANSACTION_STEPS hts,
    PER_ANALYSIS_CRITERIA pac,
    hr.Ame_Approvals_History ah,
    per_people_f ppf,
    per_people_f ppf2,
    apps.fnd_user fu,
    apps.AME_TEMP_OLD_APPROVER_LISTS al,
    apps.AME_TEMP_OLD_APPROVER_LISTS almin
    WHERE al.application_id = '-81'
    AND al.transaction_id = ht.TRANSACTION_ID
    AND (al.approval_status NOT LIKE '%REP%'
    OR al.approval_status IS NULL)
    AND al.order_number =
    (SELECT MAX (ao.order_number)
    FROM apps.AME_TEMP_OLD_APPROVER_LISTS ao
    WHERE ao.transaction_id =
    ht.TRANSACTION_ID
    AND (ao.approval_status NOT LIKE
    '%REP%'
    OR ao.approval_status IS NULL))
    AND ht.creator_person_id = PPF.PERSON_ID
    AND ht.TRANSACTION_ID = ah.transaction_id
    AND HT.TRANSACTION_ID = HTS.TRANSACTION_ID
    AND fu.employee_id = PPF2.person_id
    AND almin.order_number =
    (SELECT MIN (aomin.order_number)
    FROM apps.AME_TEMP_OLD_APPROVER_LISTS aomin
    WHERE aomin.transaction_id =
    ht.TRANSACTION_ID
    AND aomin.approval_status IS NULL)
    AND almin.transaction_id = ht.TRANSACTION_ID
    AND almin.name = fu.user_name
    AND hts.TRANSACTION_STEP_ID =
    HTV.TRANSACTION_STEP_ID
    AND HTV.NAME = 'P_ANALYSIS_CRITERIA_ID'
    AND HTV.NUMBER_VALUE =
    PAC.ANALYSIS_CRITERIA_ID
    AND SYSDATE BETWEEN ppf.effective_start_date
    AND ppf.effective_end_date
    AND PROCESS_NAME = 'TA_AEC')
    UNION
    (SELECT PPF.PERSON_ID,
    ht.TRANSACTION_ID,
    pac.segment1,
    pac.segment2,
    pac.segment3,
    pac.segment4,
    pac.segment5,
    pac.segment6,
    pac.segment7,
    pac.segment8,
    pac.segment9,
    pac.creation_date,
    DECODE (al.approval_status,
    NULL, 'Pending For Approval',
    'APPROVE', 'Finally Approved',
    al.approval_status)
    status,
    al.order_number,
    al.order_number AS approver_order,
    '' AS name
    FROM HR_API_TRANSACTION_Values htv,
    HR_API_TRANSACTIONS ht,
    HR_API_TRANSACTION_STEPS hts,
    PER_ANALYSIS_CRITERIA pac,
    hr.Ame_Approvals_History ah,
    per_people_f ppf,
    per_people_f ppf2,
    apps.fnd_user fu,
    apps.AME_TEMP_OLD_APPROVER_LISTS al,
    apps.AME_TEMP_OLD_APPROVER_LISTS almin
    WHERE al.application_id = '-81'
    AND al.approval_status IS NOT NULL
    AND al.transaction_id = ht.TRANSACTION_ID
    AND ht.creator_person_id = PPF.PERSON_ID
    AND ht.TRANSACTION_ID = ah.transaction_id
    AND HT.TRANSACTION_ID = HTS.TRANSACTION_ID
    AND PROCESS_NAME = 'TA_AEC'
    AND fu.employee_id = PPF2.person_id
    AND al.order_number =
    (SELECT MAX (ao.order_number)
    FROM apps.AME_TEMP_OLD_APPROVER_LISTS ao
    WHERE ao.transaction_id =
    ht.TRANSACTION_ID
    AND (ao.approval_status NOT LIKE
    '%REP%'
    OR ao.approval_status IS NULL))
    AND al.name = fu.user_name
    AND almin.transaction_id = ht.TRANSACTION_ID
    AND hts.TRANSACTION_STEP_ID =
    HTV.TRANSACTION_STEP_ID
    AND HTV.NAME = 'P_ANALYSIS_CRITERIA_ID'
    AND HTV.NUMBER_VALUE = PAC.ANALYSIS_CRITERIA_ID
    AND SYSDATE BETWEEN ppf.effective_start_date
    AND ppf.effective_end_date
    AND PROCESS_NAME = 'TA_AEC'))) QRSLT
    WHERE (person_id = 26773)
    ORDER BY request_date DESC

    see also this . .
    Optimizer Environment (10053)
    #     Is
    Default     Parameter     Current
    Value
    1     N     _sort_elimination_cost_ratio     5
    2     N     _pga_max_size     838860 KB
    3     N     _b_tree_bitmap_plans     false
    4     N     _fast_full_scan_enabled     false
    5     N     _like_with_bind_as_equality     true
    6     N     optimizer_secure_view_merging     false
    7     Y     optimizer_mode_hinted     false
    8     Y     optimizer_features_hinted     0.0.0
    9     Y     parallel_execution_enabled     true
    10     Y     parallel_query_forced_dop     0
    11     Y     parallel_dml_forced_dop     0
    12     Y     parallel_ddl_forced_degree     0
    13     Y     parallel_ddl_forced_instances     0
    14     Y     _query_rewrite_fudge     90
    15     Y     optimizer_features_enable     10.2.0.4
    16     Y     _optimizer_search_limit     5
    17     Y     cpu_count     4
    18     Y     active_instance_count     1
    19     Y     parallel_threads_per_cpu     2
    20     Y     hash_area_size     131072
    21     Y     bitmap_merge_area_size     1048576
    22     Y     sort_area_size     65536
    23     Y     sort_area_retained_size     0
    24     Y     _optimizer_block_size     8192
    25     Y     _sort_multiblock_read_count     2
    26     Y     _hash_multiblock_io_count     0
    27     Y     _db_file_optimizer_read_count     8
    28     Y     _optimizer_max_permutations     2000
    29     Y     pga_aggregate_target     4194304 KB
    30     Y     _query_rewrite_maxdisjunct     257
    #     Is
    Default     Parameter     Current
    Value
    31     Y     _smm_auto_min_io_size     56 KB
    32     Y     _smm_auto_max_io_size     248 KB
    33     Y     _smm_min_size     1024 KB
    34     Y     _smm_max_size     419430 KB
    35     Y     _smm_px_max_size     2097152 KB
    36     Y     _cpu_to_io     0
    37     Y     _optimizer_undo_cost_change     10.2.0.4
    38     Y     parallel_query_mode     enabled
    39     Y     parallel_dml_mode     disabled
    40     Y     parallel_ddl_mode     enabled
    41     Y     optimizer_mode     all_rows
    42     Y     sqlstat_enabled     false
    43     Y     _optimizer_percent_parallel     101
    44     Y     _always_anti_join     choose
    45     Y     _always_semi_join     choose
    46     Y     _optimizer_mode_force     true
    47     Y     _partition_view_enabled     true
    48     Y     _always_star_transformation     false
    49     Y     _query_rewrite_or_error     false
    50     Y     _hash_join_enabled     true
    51     Y     cursor_sharing     exact
    52     Y     star_transformation_enabled     false
    53     Y     _optimizer_cost_model     choose
    54     Y     _new_sort_cost_estimate     true
    55     Y     _complex_view_merging     true
    56     Y     _unnest_subquery     true
    57     Y     _eliminate_common_subexpr     true
    58     Y     _pred_move_around     true
    59     Y     _convert_set_to_join     false
    60     Y     _push_join_predicate     true
    #     Is
    Default     Parameter     Current
    Value
    61     Y     _push_join_union_view     true
    62     Y     _optim_enhance_nnull_detection     true
    63     Y     _parallel_broadcast_enabled     true
    64     Y     _px_broadcast_fudge_factor     100
    65     Y     _ordered_nested_loop     true
    66     Y     _no_or_expansion     false
    67     Y     optimizer_index_cost_adj     100
    68     Y     optimizer_index_caching     0
    69     Y     _system_index_caching     0
    70     Y     _disable_datalayer_sampling     false
    71     Y     query_rewrite_enabled     true
    72     Y     query_rewrite_integrity     enforced
    73     Y     _query_cost_rewrite     true
    74     Y     _query_rewrite_2     true
    75     Y     _query_rewrite_1     true
    76     Y     _query_rewrite_expression     true
    77     Y     _query_rewrite_jgmigrate     true
    78     Y     _query_rewrite_fpc     true
    79     Y     _query_rewrite_drj     true
    80     Y     _full_pwise_join_enabled     true
    81     Y     _partial_pwise_join_enabled     true
    82     Y     _left_nested_loops_random     true
    83     Y     _improved_row_length_enabled     true
    84     Y     _index_join_enabled     true
    85     Y     _enable_type_dep_selectivity     true
    86     Y     _improved_outerjoin_card     true
    87     Y     _optimizer_adjust_for_nulls     true
    88     Y     _optimizer_degree     0
    89     Y     _use_column_stats_for_function     true
    90     Y     _subquery_pruning_enabled     true
    #     Is
    Default     Parameter     Current
    Value
    91     Y     _subquery_pruning_mv_enabled     false
    92     Y     _or_expand_nvl_predicate     true
    93     Y     _table_scan_cost_plus_one     true
    94     Y     _cost_equality_semi_join     true
    95     Y     _default_non_equality_sel_check     true
    96     Y     _new_initial_join_orders     true
    97     Y     _oneside_colstat_for_equijoins     true
    98     Y     _optim_peek_user_binds     true
    99     Y     _minimal_stats_aggregation     true
    100     Y     _force_temptables_for_gsets     false
    101     Y     workarea_size_policy     auto
    102     Y     _smm_auto_cost_enabled     true
    103     Y     _gs_anti_semi_join_allowed     true
    104     Y     _optim_new_default_join_sel     true
    105     Y     optimizer_dynamic_sampling     2
    106     Y     _pre_rewrite_push_pred     true
    107     Y     _optimizer_new_join_card_computation     true
    108     Y     _union_rewrite_for_gs     yes_gset_mvs
    109     Y     _generalized_pruning_enabled     true
    110     Y     _optim_adjust_for_part_skews     true
    111     Y     _force_datefold_trunc     false
    112     Y     statistics_level     typical
    113     Y     _optimizer_system_stats_usage     true
    114     Y     skip_unusable_indexes     true
    115     Y     _remove_aggr_subquery     true
    116     Y     _optimizer_push_down_distinct     0
    117     Y     _dml_monitoring_enabled     true
    118     Y     _optimizer_undo_changes     false
    119     Y     _predicate_elimination_enabled     true
    120     Y     _nested_loop_fudge     100
    #     Is
    Default     Parameter     Current
    Value
    121     Y     _project_view_columns     true
    122     Y     _local_communication_costing_enabled     true
    123     Y     _local_communication_ratio     50
    124     Y     _query_rewrite_vop_cleanup     true
    125     Y     _slave_mapping_enabled     true
    126     Y     _optimizer_cost_based_transformation     linear
    127     Y     _optimizer_mjc_enabled     true
    128     Y     _right_outer_hash_enable     true
    129     Y     _spr_push_pred_refspr     true
    130     Y     _optimizer_cache_stats     false
    131     Y     _optimizer_cbqt_factor     50
    132     Y     _optimizer_squ_bottomup     true
    133     Y     _fic_area_size     131072
    134     Y     _optimizer_skip_scan_enabled     true
    135     Y     _optimizer_cost_filter_pred     false
    136     Y     _optimizer_sortmerge_join_enabled     true
    137     Y     _optimizer_join_sel_sanity_check     true
    138     Y     _mmv_query_rewrite_enabled     true
    139     Y     _bt_mmv_query_rewrite_enabled     true
    140     Y     _add_stale_mv_to_dependency_list     true
    141     Y     _distinct_view_unnesting     false
    142     Y     _optimizer_dim_subq_join_sel     true
    143     Y     _optimizer_disable_strans_sanity_checks     0
    144     Y     _optimizer_compute_index_stats     true
    145     Y     _push_join_union_view2     true
    146     Y     _optimizer_ignore_hints     false
    147     Y     _optimizer_random_plan     0
    148     Y     _query_rewrite_setopgrw_enable     true
    149     Y     _optimizer_correct_sq_selectivity     true
    150     Y     _disable_function_based_index     false
    #     Is
    Default     Parameter     Current
    Value
    151     Y     _optimizer_join_order_control     3
    152     Y     _optimizer_cartesian_enabled     true
    153     Y     _optimizer_starplan_enabled     true
    154     Y     _extended_pruning_enabled     true
    155     Y     _optimizer_push_pred_cost_based     true
    156     Y     _sql_model_unfold_forloops     run_time
    157     Y     _enable_dml_lock_escalation     false
    158     Y     _bloom_filter_enabled     true
    159     Y     _update_bji_ipdml_enabled     0
    160     Y     _optimizer_extended_cursor_sharing     udo
    161     Y     _dm_max_shared_pool_pct     1
    162     Y     _optimizer_cost_hjsmj_multimatch     true
    163     Y     _optimizer_transitivity_retain     true
    164     Y     _px_pwg_enabled     true
    165     Y     _optimizer_join_elimination_enabled     true
    166     Y     flashback_table_rpi     non_fbt
    167     Y     _optimizer_cbqt_no_size_restriction     true
    168     Y     _optimizer_enhanced_filter_push     true
    169     Y     _optimizer_filter_pred_pullup     true
    170     Y     _rowsrc_trace_level     0
    171     Y     _simple_view_merging     true
    172     Y     _optimizer_rownum_pred_based_fkr     true
    173     Y     _optimizer_better_inlist_costing     all
    174     Y     _optimizer_self_induced_cache_cost     false
    175     Y     _optimizer_min_cache_blocks     10
    176     Y     _optimizer_or_expansion     depth
    177     Y     _optimizer_order_by_elimination_enabled     true
    178     Y     _optimizer_outer_to_anti_enabled     true
    179     Y     _selfjoin_mv_duplicates     true
    180     Y     _dimension_skip_null     true
    #     Is
    Default     Parameter     Current
    Value
    181     Y     _force_rewrite_enable     false
    182     Y     _optimizer_star_tran_in_with_clause     true
    183     Y     _optimizer_complex_pred_selectivity     true
    184     Y     _optimizer_connect_by_cost_based     true
    185     Y     _gby_hash_aggregation_enabled     true
    186     Y     _globalindex_pnum_filter_enabled     true
    187     Y     _fix_control_key     0
    188     Y     _optimizer_skip_scan_guess     false
    189     Y     _enable_row_shipping     false
    190     Y     _row_shipping_threshold     80
    191     Y     _row_shipping_explain     false
    192     Y     _optimizer_rownum_bind_default     10
    193     Y     _first_k_rows_dynamic_proration     true
    194     Y     _px_ual_serial_input     true
    195     Y     _optimizer_native_full_outer_join     off
    196     Y     _optimizer_star_trans_min_cost     0
    197     Y     _optimizer_star_trans_min_ratio     0
    198     Y     _optimizer_fkr_index_cost_bias     10
    199     Y     _optimizer_connect_by_combine_sw     true
    200     Y     _optimizer_use_subheap     true
    201     Y     _optimizer_or_expansion_subheap     true
    202     Y     _optimizer_sortmerge_join_inequality     true
    203     Y     _optimizer_use_histograms     true
    204     Y     _optimizer_enable_density_improvements     false

  • Exact time of SQL query execution.

    Hi,
    Is there any way to get the exact time of execution of particular SQL query.
    Oracle Version : 10.2.0.4.0
    OS : Sun OS.
    Thx,
    Gowin.

    In general it's pretty hard.
    Look at V$SQLSTAT.ELAPSED_TIME and DBA_HIST_SQLSTAT.ELAPSED_TIME_TOTAL/DELTA (need a license).
    It will give you accurate results for a non-parallel query. For parallel queries you'll get a total time spent by all slaves.
    Also you can enable tracing either on database or session level and analyze the trace files generated.
    Edited by: Max Seleznev on Nov 4, 2011 12:06 PM

  • Problem with SQL Query Action

    Hi,
    I have a problem in using transactions with SQL Querys.
    I developed a TA based an SQL Querys against a MS SQL Server by using the jtds driver.
    After execution of the sql query I iterate through the result data by using the repeater action on the xMII XML results of the query. Using the jtds driver all table and field names are in lower case letters.
    Now I changed the data server to test it with oracle to an oracle database by using the oracle jdbc driver. The database and tables on both Oracle and MS are created with the same sql script.
    The oracle driver returns table and field names in only capital letters. So the created transaction can not be used. Because it for example accesses the node "type" in the XML structure which is fine for jtds. But when oracle is used, the node has the name "TYPE", so the TA tries to use node type but there is only node TYPE that causes the TA to run into an error.
    Anyone has an idea how to avoid / solve this problem?
    Regards
    Timo

    That's exactly what I used as solution now.
    Instead of doing
    "select fieldname from tablename"
    I do now
    "select fieldname as "fieldname" from tablename"
    So both in Oracle and Microsoft SQL Server the returned field names of the query are in lower case letters.
    Thank you for your help.
    Regards Timo

  • Query on Reoprts-pl/sql function body returning sql query

    Hi,
    I am facing a starnge problem.. and would like to know the reason for it.
    The situation is as follows:
    I have a report (pl/sql function body returning sql query based). My query is as follows:
    declare
    l_query1 varchar2(2000);
    begin
    if (:P102_min_value is not null and :P102_max_value is null) then
    l_query1 := 'select decode(:P102_date,'1',date1) Transaction_Date, decode(:P102_first_name,'2',first_name) First_Name from (
    select * from MORTGAGE_LOAN_LEADS where APPRX_LOAN_AMOUNT >=:P102_min_value
    return (l_query1);
    end if;
    end;
    This returns the error as :
    1 error has occurred
    Function returning SQL query: Query cannot be parsed within the Builder. If you believe your query is syntactically correct, check the generic columns checkbox below the region source to proceed without parsing.
    (ORA-06550: line 7, column 20: PLS-00103: Encountered the symbol "1" when expecting one of the following: * & = - + ; < / > at in is mod remainder not rem <> or != or ~= >= <= <> and or like LIKE2_ LIKE4_ LIKEC_ between || multiset member SUBMULTISET_)
    How do i correct this? am i right in thinking that the single quotes indicating a string within a select query is creating the problem? Beacuse if i use an sql query report and use the following query, it is working fine...
    select
    decode(:P102_date,'1',date1) Transaction_Date,
    decode(:P102_first_name,'2',first_name) First_Name
    from (
    select * from MORTGAGE_LOAN_LEADS where APPRX_LOAN_AMOUNT >=:P102_min_value
    But i need to write pl/sql function, so that multiple report can be returned based on different conditions. Please guide me.
    Thanks,
    Sumana

    Does that mean that both in if and else we need to have same columns selected?
    if thats the case.. any idea how i can implement it in my code. The situation here is that the columns that need to be selected are dynamic and keep on changing...
    if i try to implement like this and run the page, it gives the following error:
    Query is:
    declare
    l_query1 varchar2(4000);
    begin
    if apex_application.get_current_flow_sgid(:APP_ID) = apex_application.get_sgid then
    if (:P102_min_value is not null and :P102_max_value is null) then
    l_query1 := 'select decode(' || :P102_date|| ',''1'',date1) Transaction_Date, decode(' || :P102_first_name || ',''2'',first_name) First_Name from (
    select * from MORTGAGE_LOAN_LEADS where APPRX_LOAN_AMOUNT >=' || :P102_min_value ||'
    elsif (:P102_min_value is null and :P102_max_value is not null) then
    l_query1 := 'select decode(' || :P102_date|| ',''1'',date1) Transaction_Date, decode(' || :P102_first_name || ',''2'',first_name) First_Name from (
    select * from MORTGAGE_LOAN_LEADS where APPRX_LOAN_AMOUNT >=' || :P102_max_value ||'
    else
    l_query1 := 'select date1,first_name from MORTGAGE_LOAN_LEADS where rownum = 1';
    end if;
    else
    l_query1 := 'select date1,first_name from MORTGAGE_LOAN_LEADS where rownum = 1';
    end if;
    return l_query1;
    --dbms_output.put_line( l_query1);
    end;
    The Error is:
    failed to parse SQL query:
    ORA-00936: missing expression
    If i try to run the same in command prompt, it always goes to the else part... (else of outer if)

  • ORA-06502 on  'SQL query' report with sort in 'Report Attributes'

    Hi All,
    We get the next error if we set sorting on a column in a 'Report' based on a 'SQL query'. Removing the sort, error disappeares:
    failed to parse SQL query:
    ORA-06502: PL/SQL: numeric or value error: NULL index table key value
    Any suggestions?
    Erik

    Erik,
    Thanks, this explains it. By specifying the request as part of your URL you run into the recently uncovered issue. The request you're setting is REMFROMLIST and ADD2LIST. You probably either have links that include those requests or you have branches where you specify them. Either way, in order to get reports sorting to work, you'll have to make sure that the request strings are not part of your URL. This is a work-around and the upcoming HTML DB patch release will solve this issue.
    One way of avoiding this is to have computations on the previous pages that set a napplication level or page level item to the REMFROMLIST and ADD2LIST values and then you can use those items for your conditions that are currently evaluating those strings.
    Hope this helps and sorry for the inconvenience,
    Marc

  • Problem With SQL Query (updateable report)

    Hi,
    I have a report which I have set as type 'SQL Query (updateable report)'. I have added a 'row selector' to the report but when I run it I get the following error message:
    failed to parse SQL query:
    ORA-00904: "COL60": invalid identifier
    The report works fine if I remove the row selector. Any ideas as to why the error is being produced?
    Cheers
    Simon

    I don't have the apex_application.g_f01(i) referenced in the page source...In the page source you wouldn't find anything by that name
    Identify the tabular form's checkbox column in the page(firebug/chrome developer panel makes this easy)
    It should be like
    &lt;input id=&quot;...&quot; value=&quot;&quot; type=&quot;checkbox&quot; name=&quot;fXX&quot; &gt;we are interested in the name attribute , get that number (between 01 and 50)
    Replace that number in the code, for instance if it was f05 , the code would use
    apex_application.g_f05
    --i'th checked record' primary keyWhen you loop through a checkbox array, it only contains the rows which are checked and it is common practice to returns the record's primary key as the value of the checkbox(available as the the i'th array index as apex_application.g_f05(i) , where i is sequence position of the checked row) so that you can identify the record.

  • Syntax error or access violation near ; (SQL)

    Hey, it's not a question, but an observation. Hope it could help someone.
    There is an error in the following code:
    <sql:query var="profileQuery" dataSource="${profileDS}">
    SELECT * FROM singles.profiles;
    </sql:query>
    Can you spot it ?
    Hehehe, it took me probably 30 minutes to find it .. it's so inconspicuous...
    Turns out you must not put a semicolon after your SQL statement in JSP files.
    Dennis

    That's because semicolons are used to seperate SQL statements when you use compound statements, i.e "insert into a(b) values('c');insert into a(b) values('d')" can be executed in one statement. When the database sees the semicolon it expects another statement, and some databases cannot handle i f it's empty.
    /Fredrik

  • Problem in importing oracle.xml.sql.query.*

    When i am importing this
    import oracle.xml.sql.query.*;
    it is giving me error that
    "package oracle.xml.sql.query.* does not exist".
    What Should i install or set .

    [from XmlRpc-Java]
    As a result, my XML
    is contained in a String instead of an InputStream.
    It is possible to convert a String to an InputStream using
    StringBufferInputStream, but this class is deprecated in favor of
    StringReader (as StringBufferInputStream does not properly convert
    characters into bytes).
    For the default HTTP transport, an InputStreamReader could be used to
    wrap the InputStream before calling parse().
    Ultimately, the InputStream is converted to an InputSource for use by
    the SAX parser. InputSource will accept a Reader as well.
    [from XmlRpc-Java]
    There should be a way to go from "getXMLString()" to "parse(Reader)" also. In the meantime I'm stuck.
    null

  • ORA-00904 ON A PLSQL QUERY RETURNING SQL QUERY ( NOT ALWAYS )

    Running a classic report , we sometimes face the error :
    <pre>failed to parse SQL query:
    ORA-00904: : invalid identifier
    Even when using the same parameters, sometimes the report runs and some others we get the error.
    The report is called by a url from a different page
    f?p=&APP_ID.:500:&APP_SESSION.:FLOW_EXCEL_OUTPUT_R&P503_RUN_REGION_ID._el:NO::P500_RUN_RG,P500_RG11_FILTER1:1,&P503_FILTER1.
    THE EVNVIRONMENT IS THE FOLLOWING
    ORACLE DATABASE 11g      Enterprise Edition Release 11.2.0.2.0 -64bit
    Apex                     Application Express 4.1.0.00.32
    In the apex on the same workspace we have 2 copies of the same application having different schema.
    We did not face this problem in Oracle 10g

    hello,
    I send you the function. rs_check_limit .
    In one case when i tried to debug in order to understand the error, the function was not fired.
    FUNCTION rs_check_limit ( p_trade_date_from date
    , p_trade_date_to date, p_session_id number , p_user_id varchar2
    , p_pct_sum_prcp_cd number
    ,p_rs_list_exclude varchar2 default ' '
    return rs_check_limit_tb PIPELINED
    is
    v_data rs_check_limit_tp :=rs_check_limit_tp ( null, null,null, null,null, null,null, null,null, null );
    CURSOR exec_trades_prcp_cur (vc_risk_date_from date
    , vc_risk_date_to date
    , vc_rs_list_exclude varchar2
    is
    select PRCP_CD
    , clr_sys_cd
    , clr_acc_cd
    ,avg( exec_trades_value_mkt ) avg_exec_trades_prcp
    ,SUM( exec_trades_value_mkt ) sum_exec_trades_prcp
    from
    select trd_dt, PRCP_CD , clr_sys_cd
    , clr_acc_cd , sum ( exec_trades_value_mkt ) exec_trades_value_mkt
    from
    select lst_cmpt_dt trd_dt , PRCP_CD , clr_sys_cd
    , clr_acc_cd
    ,SUM (BUYS_VALUE+ SELLS_VALUE) exec_trades_value_mkt
    from rs_mm_rsk_lmts_dtls
    where 1=1
    and lst_cmpt_dt > vc_risk_date_from -1
    and lst_cmpt_dt <= vc_risk_date_to
    and instr( vc_rs_list_exclude, TRIM(clr_acc_cd)|| '.')= 0
    group by lst_cmpt_dt , PRCP_CD , clr_sys_cd
    , clr_acc_cd
    UNION ALL
    select trunc ( apx_rs_risk_info.get_d_n_cur (lst_cmpt_dt,- 1) ) trd_dt , PRCP_CD , clr_sys_cd
    , clr_acc_cd, SUM (BUYS_VALUE+ SELLS_VALUE) exec_trades_value_mkt
    from rs_mm_rsk_lmts_dtls
    where trd_dt = apx_rs_risk_info.get_d_n_cur ( lst_cmpt_dt , 2 )
    and lst_cmpt_dt > apx_rs_risk_info.get_d_n_cur (vc_risk_date_from ,1 )-1
    and lst_cmpt_dt < vc_risk_date_to
    and instr( vc_rs_list_exclude, TRIM(clr_acc_cd)|| '.')= 0
    group by apx_rs_risk_info.get_d_n_cur (lst_cmpt_dt , -1 ) ,PRCP_CD , clr_sys_cd
    , clr_acc_cd
    group by trd_dt, PRCP_CD , clr_sys_cd
    , clr_acc_cd
    group by PRCP_CD , clr_sys_cd
    , clr_acc_cd
    CURSOR exec_trades_all_cur (vc_risk_date_from date
    , vc_risk_date_to date
    , vc_rs_list_exclude varchar2)
    is
    select SUM( exec_trades_value_mkt ) sum_exec_trades_all -- óõíïëéêÞ çìåñÞóéá áîßá óõíáëëáãùí áãïñÜò
    , avg( exec_trades_value_mkt ) avg_exec_trades_all
    from
    select trd_dt, sum( exec_trades_value_mkt ) exec_trades_value_mkt
    from
    --gia  T : T, T-1 ,  T-2
    select lst_cmpt_dt trd_dt , SUM (BUYS_VALUE+ SELLS_VALUE) exec_trades_value_mkt
    from rs_mm_rsk_lmts_dtls
    where 1=1
    and lst_cmpt_dt > vc_risk_date_from -1
    and lst_cmpt_dt <= vc_risk_date_to
    and instr( vc_rs_list_exclude, TRIM(clr_acc_cd)|| '.')= 0
    group by lst_cmpt_dt
    union all
    --gia  T EPIPLEON: T-3
    select apx_rs_risk_info.get_d_n_cur (lst_cmpt_dt,-1) trd_dt , SUM (BUYS_VALUE+ SELLS_VALUE) exec_trades_value_mkt
    from rs_mm_rsk_lmts_dtls
    where trd_dt = apx_rs_risk_info.get_d_n_cur ( trunc ( lst_cmpt_dt ) , +2 )
    and lst_cmpt_dt > apx_rs_risk_info.get_d_n_cur (vc_risk_date_from ,1 )-1
    and lst_cmpt_dt < vc_risk_date_to
    and instr( vc_rs_list_exclude, TRIM(clr_acc_cd)|| '.')= 0
    group by apx_rs_risk_info.get_d_n_cur (lst_cmpt_dt , -1 )
    group by trd_dt
    exec_trades_prcp_row exec_trades_prcp_cur%rowtype;
    exec_trades_all_row exec_trades_all_cur%rowtype;
    i number := 0;
    tmp varchar2(4) := null;
    procedure feed_table is
    BEGIN
    v_data.prcp_cd := exec_trades_prcp_row.prcp_cd;
    v_data.clr_sys_cd := exec_trades_prcp_row.clr_sys_cd;
    v_data.clr_acc_cd := trim(exec_trades_prcp_row.clr_acc_cd);
    v_data.member_id := RS_GET_PRCP_MEMBER_ID(exec_trades_prcp_row.prcp_cd);
    v_data.member_dsc := RS_GET_PRCP_DSC(exec_trades_prcp_row.prcp_cd);
    v_data.sumTRADES_VALUE_PRCP_CD_T := round( exec_trades_prcp_row.sum_exec_trades_prcp,2);
    v_data.mkt_sumTRADES_VALUE_PRCP_CD_T := round( exec_trades_all_row.sum_exec_trades_all,2) ;
    v_data.avgTRADES_VALUE_PRCP_CD_T := round( exec_trades_prcp_row.avg_exec_trades_prcp,2);
    v_data.mkt_avgTRADES_VALUE_PRCP_CD_T := round( exec_trades_all_row.avg_exec_trades_all,2) ;
    v_data.pct_sum_prcp_cd := round( 100* exec_trades_prcp_row.sum_exec_trades_prcp
    / exec_trades_all_row.sum_exec_trades_all , 2);
    end ;
    begin
    exec_trades_all_row := null;
    open exec_trades_all_cur (vc_risk_date_from => p_trade_date_from
    , vc_risk_date_to => p_trade_date_to
    ,vc_rs_list_exclude => NVL(p_rs_list_exclude ,'.' )
    fetch exec_trades_all_cur INTO exec_trades_all_row;
    close exec_trades_all_cur;
    for exec_trades_prcp_rec in exec_trades_prcp_cur (vc_risk_date_from => p_trade_date_from
    , vc_risk_date_to => p_trade_date_to
    ,vc_rs_list_exclude => NVL(p_rs_list_exclude ,'.' )
    loop
    exec_trades_prcp_row := exec_trades_prcp_rec;
    if exec_trades_all_row.sum_exec_trades_all <> 0 then
    if 100* exec_trades_prcp_row.sum_exec_trades_prcp
    / exec_trades_all_row.sum_exec_trades_all >= p_pct_sum_prcp_cd then
    i := i+1;
    v_data :=rs_check_limit_tp ( null, null,null, null,null, null,null, null,null, null );
    feed_table;
    pipe row ( v_data );
    end if;
    end if;
    end loop;
    end;
    I send you the dll for the type
    CREATE OR REPLACE
    TYPE rs_check_limit_tp as object
    prcp_cd varchar2(10)
    , member_id varchar2(4)
    , member_dsc varchar2(120)
    , clr_sys_cd varchar2(4)
    , clr_acc_cd varchar2(6)
    , avgTRADES_VALUE_PRCP_CD_T number
    , mkt_avgTRADES_VALUE_PRCP_CD_T number
    , sumTRADES_VALUE_PRCP_CD_T number
    , mkt_sumTRADES_VALUE_PRCP_CD_T number
    , pct_sum_prcp_cd number
    and the table dll
    CREATE TABLE rs_mm_rsk_lmts_dtls
    (trd_dt DATE NOT NULL,
    prcp_cd VARCHAR2(10 BYTE) NOT NULL,
    clr_sys_cd CHAR(4 BYTE),
    clr_acc_cd CHAR(10 BYTE),
    sec_isin_cd VARCHAR2(12 BYTE) NOT NULL,
    buys NUMBER(19,0),
    sells NUMBER(19,0),
    buys_value NUMBER(19,6),
    sells_value NUMBER(19,6),
    abs_b_minus_s NUMBER(19,2),
    rsk_prc NUMBER(13,6),
    net_value NUMBER(19,2) NOT NULL,
    sr NUMBER(19,2) NOT NULL,
    mm NUMBER(19,2) NOT NULL,
    lst_cmpt_dt DATE,
    usr_id VARCHAR2(8 BYTE) NOT NULL,
    cmt VARCHAR2(64 BYTE),
    chg_dt DATE,
    gr_b NUMBER(19,2) NOT NULL,
    gr_s NUMBER(19,2) NOT NULL)
    Thank you
    Tonia

  • Flash Chart Series : SQL Query Validation

    Hello,
    I probably found a bug on the SQL Query Validation for Flash Charts, if I have two subqueries, the validation fails:
    SQL Query example:
    SELECT NULL, a, b
    FROM (SELECT c a, d b FROM
    ( SELECT 'first' c, 2 d FROM DUAL))
    Error returned:
    "Failed to parse SQL query:
    ORA-06550: line 1, column 45: PLS-00428: an INTO clause is expected in this SELECT statement"
    Is this problem known or is there just something that I do wrong ?
    Christophe

    Yes it was that problem, but I still have an issue:
    How do I set the Flash Chart to use a PL/SQL function in the first place ?
    When I try to enter:
    "return package.function;" in the Create Region Wizard, I get the following error:
    Failed to parse SQL query:
    return EXPERT.getFullListSQLByNC
    ORA-00900: invalid SQL statement
    Certain queries can only be executed when running your application, if your query appears syntactically correct, you can save your query without validation (see options below query source).

  • SQL query automation and output to text file

    The bcp utility should handle this task pretty easily for you. The documentation is available here.

    I know enough SQL to get me by with the few things I currently do in it (but would always like to know and do more).  Anyway, I was just recently asked if I could come up with a way to automate the execution of a SQL query we currently manually run, and then have the results of that query output (instead of to the screen in SSMS) to a text file with the ".dat" extension.  I've never automated a SQL query before nor have I had the results output to a file.  Can anyone give me some pointers on how to tackle this?
    The query currently calls to a stored procedure (which does all the work) and just executes it with some given dates from the query so I'm thinking the output will need to come from the stored procedure (and the code for output to a file added there?)
    This topic first appeared in the Spiceworks Community

Maybe you are looking for

  • User Proxy Settings

    Is there any way of forcing the proxy username and password to be the login name and password. The problem I have is students not clicking the save to keychain clickbox, then using other peoples proxy login and password as it may have different permi

  • 3.1.2 disabled apps

    I synced my iPod today and downloaded the 3.1.2 upgrade. Now the apps I downloaded won't work. How do I fix the problem?

  • Deleting E-mails from Gmail

    Hi, I have been using Mail App on my Mac for 4 months. Since then, all what I do when I need to delete an email, is simply to press back space, and it moves the email to Trash. Last week, I have noticed that all e-mails I have deleted are still avail

  • Bose - airport extreme problem

    when i try to connect my bose wifi speaker to my airport extreme it says password incorrect, but the password is correct because i have connected to the network with my laptop and iphone, then i connect the bose speaker to a tp link wifi network with

  • Log on b2b webshop difficulty

    hi I used the link "http://Host:50000/b2b/user/login.do" and entered in to logon page of webshop. But when i tried to enter the webshop with webadmin user, iam getting the message "Logon is invalid; check your entries " what are the rules to enter it