JComboBox or JList with SQL queries. Best practises.

Hi!
I'm wondering what you do in the following situation, providing you develop a hotel reservation application and you have a form where you enter room details: room number, number of rooms, description and type (JComboBox).
So when executing an INSERT query what do you usually do? Do you store ID's of types or execute addtion SELECT query to get the if of the selected type?

Thank you very much! I like your approach, but what if I should fill in a form automatically? I mean I have a section in my application where you can edit rooms, you choose a room from a JList and fter clicking on a particular room, the fields of the form get entered and if I have a JComboBox there what should I do?
I use this approach:
<code>
public void valueChanged ( ListSelectionEvent e )
Item item = ( Item ) lRooms.getSelectedValue();
try {
Db db = new Db ();
ResultSet rs = db.executeQuery ( "SELECT * FROM rooms " +
"WHERE id = " + item.getId () );
rs.next ();
pRoomsEdit.this.id = rs.getInt ( "id" );
tfNo.setText ( item.getName () );
ComboBoxModel cbm = cbType.getModel ();
ResultSet rsType = db.executeQuery ( "SELECT name FROM types " +
"WHERE id = " + rs.getString ( "type" ) );
rsType.next ();
cbm.setSelectedItem ( new Item ( rs.getInt ( "id" ), rsType.getString ( "name" ) ) );
tfRoomNum.setText ( rs.getString ( "roomNum" ) );
taDesc.setText ( rs.getString ( "description" ) );
catch ( SQLException se ) {
se.printStackTrace ();
</code>

Similar Messages

  • Generate ER Diagram with Sql Queries ?

    Hi Expertie,
    I am new to Oracle Sql Developer Data Modeler.
    I am having doubt in Oracle Sql Developer Data Modeler. Can we create ER Diagram with sql queries ?
    Ex: select Ename, EAge, Eemail, ESalary, DDept, Dname, Estatus from Emp E join Dept D on E.EmpId = D.Empid
          Where EAge in (20, 25, 30, 35)
    Please provide me the answer and suggestion. It will be greatful for me.
    Thanks & Regards
    Bhaskar

    Yes, you can engineer your physical model to a logical one, then you'll have an ERD as well. It's a right-click on the model I believe.
    To be more specific, if you relational model is loaded, you can use the button in the toolbar that looks like a double-blue-arrow, or you can mouse-right-click on your relational model in the tree. This will engineer your model to a logical one. You'll then have your ERD.
    Edited by: Jeff Smith SQLDev PM on Apr 29, 2013 9:53 AM

  • Links with sql queries to practice

    Hi all,
    Can someone give me the links with sql queries for practice to preparing for OCP
    Thanks
    Shekar.

    Hi,
    Can u repost?? as its very difficult to understand ur problem.
    Vasu Natari.

  • SQL protection - best practises

    I need some help to understand the difference between Express full backup vs. syncronization for SQL protection. I have always thought that the SQL logs were truncated during a Express full backup, but have read several articles that claim the opposite.
    What is best practise in order to protect SQL DB's in general? And which recovery models should be used (full/simple)?
    /Amir

    Please read below
    Backing up SQL with DPM
    Why DPM 2010 and SQL are Better Together?
    SQL Logs not getting truncated ?
    (comments)
    SCDPM: Backup SQL and Truncate SQL Logs
    Have a nice day !!!
    DPM 2012 R2: Remove Recovery Points

  • Looking for a SQL report guru to help me with SQL queries

    As an independent consultant, I sometimes need to build custom SSRS reports.  I need someone I can reach out to when SQL queries become complex.  There is such a query now.
    Thanks.
    Richgar
    612-207-8347

    Thanks, Visakh,
    I'm trying to determine which resources did not fill out a timesheet.  The result of this query is missing just a few names and I can't find the reason.  I'm thinking of a web meeting looking at real data is necessary and will be glad to pay
    for the help.
    SELECT       
    ResourceName, ResourceIsGeneric, ResourceType, RBS, ResourceIsActive
    FROM           
    MSP_EpmResource_UserView
    WHERE       
    (ResourceName NOT IN
    (SELECT DISTINCT MSP_EpmResource_UserView_1.ResourceName
    FROM           
    MSP_EpmResource_UserView AS MSP_EpmResource_UserView_1 INNER JOIN
    MSP_TimesheetLine_UserView ON MSP_EpmResource_UserView_1.ResourceUID = MSP_TimesheetLine_UserView.ResourceUID INNER JOIN
    MSP_Timesheet ON MSP_TimesheetLine_UserView.TimesheetUID = MSP_Timesheet.TimesheetUID
    WHERE        (MSP_EpmResource_UserView_1.ResourceType = 2) AND (MSP_EpmResource_UserView_1.ResourceIsActive = 1) AND (MSP_EpmResource_UserView_1.RBS IS NOT NULL) AND
    (CONVERT(varchar, MSP_TimesheetLine_UserView.PeriodStartDate, 101) IN (@Period_Start_Date)) AND (MSP_EpmResource_UserView_1.RBS IN (@RBS)))) AND (ResourceIsGeneric = 0) AND
    (ResourceType = 2) AND (RBS IN (@RBS)) AND (ResourceIsActive = 1)

  • Help with SQL queries following migration

    Hi there,
    I have just migrated from MS SQL Server database to Oracle 10g database using the Oracle SQL Developer.
    My application is using JDBC to access the database, and there are heaps of SQL statements that need to be verified and tested. I've found a number of SQL compatibility issues from my testing of the Oracle database and I hope you can help me the following.
    1. Case sensitivity
    Is it possible to not enforce case sensitivity (by default) when performing a select query?
    If this is not possible, all the SQL statements will need to be changed to evaluate column based on uppercase.
    2. Trailing white space
    Is it possible to not evaluate trailing white space (by default) when performing a select query?
    For example, suppose a table column studentNo has trailing spaces (after database migration), e.g. 'A182D '
    when performing query - select * from student where studentNo = 'A182D'
    no results can be found
    3. Issue with Where condition containing with '' = ''
    There are quite a number of SQL statements with Where condition containing '' = ''.
    For example, the following SQL query doesn't return any results even though there are matching suburb that starts with 'ST'. These types of queries are mostly used in dynamic generated queries.
    select * from Address where (suburb like 'ST%') and ('' = '' or country = '')
    Any help or advice will be greatly appreciated.
    Regards,
    Jason Gordon

    As justin mentioned setting those NLS parameters will make oracle not to use your regular index. for that you must create a function based index. See example below.
    SQL> create index t_idx on t (name)
      2  /
    Index created.
    SQL> exec dbms_stats.gather_table_stats(user,'T',cascade=>true)
    PL/SQL procedure successfully completed.
    SQL> explain plan for
      2  select * from t where name = 'karthick'
      3  /
    Explained.
    SQL> select * from table(dbms_xplan.display)
      2  /
    PLAN_TABLE_OUTPUT
    Plan hash value: 2946670127
    | Id  | Operation        | Name  | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT |       |     1 |     9 |     1   (0)| 00:00:01 |
    |*  1 |  INDEX RANGE SCAN| T_IDX |     1 |     9 |     1   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    PLAN_TABLE_OUTPUT
       1 - access("NAME"='karthick')
    13 rows selected.
    SQL> delete from plan_table
      2  /
    2 rows deleted.
    SQL> alter session set NLS_COMP=ANSI;
    Session altered.
    SQL> alter session set NLS_SORT=BINARY_CI;
    Session altered.
    SQL> explain plan for
      2  select * from t where name = 'karthick'
      3  /
    Explained.
    SQL> select * from table(dbms_xplan.display)
      2  /
    PLAN_TABLE_OUTPUT
    Plan hash value: 1601196873
    | Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |      |     1 |     9 |     5   (0)| 00:00:01 |
    |*  1 |  TABLE ACCESS FULL| T    |     1 |     9 |     5   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    PLAN_TABLE_OUTPUT
       1 - filter(NLSSORT("NAME",'nls_sort=''BINARY_CI''')=HEXTORAW('6B61727
                  46869636B00') )
    14 rows selected.
    SQL> create index t_idx_1 on t(NLSSORT(name,'NLS_SORT=BINARY_CI'))
      2  /
    Index created.
    SQL> exec dbms_stats.gather_table_stats(user,'T',cascade=>true)
    PL/SQL procedure successfully completed.
    SQL> /
    create index t_idx_1 on t(NLSSORT(name,'NLS_SORT=BINARY_CI'))
    ERROR at line 1:
    ORA-00955: name is already used by an existing object
    SQL> delete from plan_table
      2  /
    2 rows deleted.
    SQL> explain plan for
      2  select * from t where name = 'karthick'
      3  /
    Explained.
    SQL> select * from table(dbms_xplan.display)
      2  /
    PLAN_TABLE_OUTPUT
    Plan hash value: 2580036035
    | Id  | Operation                   | Name    | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT            |         |     3 |    27 |     2   (0)| 00:00:01 |
    |   1 |  TABLE ACCESS BY INDEX ROWID| T       |     3 |    27 |     2   (0)| 00:00:01 |
    |*  2 |   INDEX RANGE SCAN          | T_IDX_1 |     3 |       |     1   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - access(NLSSORT("NAME",'nls_sort=''BINARY_CI''')=HEXTORAW('6B6172746869636B00') )Thanks,
    Karthick.

  • How to crete CFL with SQL queries

    Hi, First create the srf which has two buttons- Choose and Cancel code for creating the grid :- you have to pass the SQL query as a paramter in the below function .In query you choose as many as fields from the table ,at run time columns will automatically created corresponds to your query. private bool CreateGrid(string sSQL) { try { SAPbouiCOM.Item oItem; oItem = oform.Items.Add("Grid", SAPbouiCOM.BoFormItemTypes.it_GRID); oItem.Left = 7; oItem.Width = 387; oItem.Top = 47; oItem.Height = 188; oform.DataSources.DataTables.Add("dtLookUpTable"); oDataTable = oform.DataSources.DataTables.Item("dtLookUpTable"); oDataTable.Clear(); oDataTable.ExecuteQuery(sSQL); oGrid = (SAPbouiCOM.Grid)oItem.Specific; oGrid.SelectionMode = SAPbouiCOM.BoMatrixSelect.ms_Single ; oGrid.DataTable = oDataTable; if(oGrid.Rows.Count > 0) { oGrid.Rows.SelectedRows.Add(0); } for (int iColCounter = 0; iColCounter < oGrid.Columns.Count; iColCounter+) { oGrid.Columns.Item(iColCounter).Width = 50; oGrid.Columns.Item(iColCounter).Editable = false; } oGrid.AutoResizeColumns(); return true; } catch(Exception ex) { oform.Freeze(false); throw ex; } } -
    choose the value on pressing the button 'Choose' protected override void ITEMPRESS_AFTERACTION(ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent, SAPbouiCOM.Application oSboApplication, SAPbobsCOM.Company oCompany) { BubbleEvent = true; if (pVal.ItemUID == "choosebuttonuid") { if (oGrid.Rows.SelectedRows.Count > 0) { SAPbouiCOM.DataTable oReturnTable = null; oform.DataSources.DataTables.Add("dtReturnTable"); oReturnTable = oform.DataSources.DataTables.Item("dtReturnTable"); oReturnTable.CopyFrom(oDataTable); for (int iRowIndex = 0; iRowIndex < oReturnTable.Rows.Count; iRowIndex) oReturnTable.Rows.Remove(iRowIndex); int iRow = oGrid.GetDataTableRowIndex(oGrid.Rows.SelectedRows.Item(0, SAPbouiCOM.BoOrderType.ot_RowOrder)); oReturnTable.Rows.Add(1); //for (int iColIndex = 0; iColIndex < oReturnTable.Columns.Count; iColIndex+) // oReturnTable.SetValue(iColIndex, 0, oDataTable.GetValue(iColIndex, iRow)); oReturnTable.SetValue(0, 0, oDataTable.GetValue(0, iRow )); oReturnTable.SetValue(1, 0, oDataTable.GetValue(1, iRow)); SBOAppAddOn.mLookupForms.Remove(oform.UniqueID.ToString()); then u have to send the oReturnTable with parentuid( issue for production) to the baseform. example-> SendData(oReturnTable, strParentFormUID, oSboApplication, oCompany); oform.Close(); } } } More:- You have to include the Doubleclick faclity on the grid You have to include the find functionality also.

    Hi,
    Can u repost?? as its very difficult to understand ur problem.
    Vasu Natari.

  • ASSERTION_FAILED when filling dropdownbykey with sql queries

    Hi everybody,
    I'm new to WDA, and I am coding a new interface for transaction CBIH82 in EHS.
    I am filling a dropdownbykey with a sql query, for the work area.
    On the view, the dropdownbykey is populated, but when I click on a button, or when I launch an action, I have the error "ASSERTION_FAILED".
    However, if I fill the dropdownbykey manually in the code, I got no error.
    Error in IE :
    The ASSERT condition was violated
    Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/LSTANDARD===============CP
    Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/LSTANDARD===============CP
    Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/LSTANDARD===============CP
    Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/LSTANDARD===============CP
    Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/LSTANDARD===============CP
    Method: CONV_VIEW_INTO_VE_ADAPTER_TREE of program CL_WDR_INTERNAL_WINDOW_ADAPTERCP
    Method: SET_CONTENT_BY_WINDOW of program CL_WDR_INTERNAL_WINDOW_ADAPTERCP
    Method: RENDER_WINDOWS of program CL_WDR_CLIENT_SSR=============CP
    Method: IF_WDR_RESPONSE_RENDERER~RENDER_VIEWS of program CL_WDR_CLIENT_SSR=============CP
    Method: IF_WDR_RESPONSE_RENDERER~RENDER_USER_INTERFACE_UPDATES of program CL_WDR_CLIENT_SSR=============CP
    Here is the dump :
    27926     else.                                                                           
    27927       IFUR_NW5_COMBOBOX~READONLY = wd_DROPDOWN_BY_KEY->vl_READ_ONLY.                
    27928     endif.                                                                          
    27929 *   >> UCA STANDARD|ABSTR_DROPDOWN_BY_KEY|READONLY                                  
    27930     if M_PARENT_READONLY = abap_true or                                             
    27931        mv_KEY_ATTR_INFO-is_read_only = abap_true.                                   
    27932       IFUR_NW5_COMBOBOX~READONLY = abap_true.                                       
    27933     endif.                                                                          
    27934                                                                               
    27935 *   >> property-UCA IFUR_NW5_COMBOBOX~REQUIRED                                      
    27936 *   >> UCA STANDARD|DROPDOWN_BY_KEY|REQUIRED                                        
    27937     if mv_WD_STATE = cl_wd_dropdown_by_idx=>e_state-required.                       
    27938       IFUR_NW5_COMBOBOX~REQUIRED = abap_true.                                       
    27939     else.                                                                           
    27940       IFUR_NW5_COMBOBOX~REQUIRED = abap_false.                                      
    27941     endif.                                                                          
    27942                                                                               
    27943 *   >> property-Property IFUR_NW5_COMBOBOX~USEDINSAPTABLE                           
    27944     IFUR_NW5_COMBOBOX~USEDINSAPTABLE = /1WDA/VTABLE_CELL_EDITOR~mv_INSIDE_TABLE.    
    27945                                                                               
    27946 *   >> property-UCA mv_VALUE_SET                                                    
    27947 *   >> UCA STANDARD|ABSTR_DROPDOWN_BY_KEY|VALUE_SET                                 
    27948     data value_set_item type WDR_CONTEXT_ATTR_VALUE.        "#EC NEEDED             
    27949     mv_VALUE_SET = mv_KEY_ATTR_INFO-value_set.                                      
    27950     read table mv_VALUE_SET into value_set_item                                     
    27951       with key value = mv_KEY_INTERNAL.                                             
    27952     if sy-subrc = 0.                                                                
    27953       IFUR_NW5_COMBOBOX~VALUE = cl_http_utility=>escape_html( value_set_item-text ).
    27954     else.                                                                           
    27955       " entry not found - only legal for "initial" value                            
    >>>>>       assert mv_KEY_INTERNAL co ` 0`.                       "#EC NOTEXT             
    27957       IFUR_NW5_COMBOBOX~VALUE = ''.                         "#EC NOTEXT             
    27958     endif.                   
    The error is at line 27956.                                                     
    And here is my code to fill the dropdownbykey in my wddoinit of my view :
    data:
        lieux_de_travail                    type string,
        description_lieux_travail           type string,
        table_record_number_travail         type TABLE OF string,
        table_lieux_travail_full            type TABLE OF string,
        lieux_travail_full                  type string,
        record_number_travail               type string,
        valeur_int                          type i VALUE 0,
        valeur_string                       type string.
    SELECT RECNROOT FROM CCIHT_WAH INTO TABLE table_record_number_travail.
    LOOP AT table_record_number_travail INTO record_number_travail.
      SELECT WANAM FROM CCIHT_WALD INTO description_lieux_travail WHERE RECNROOT = record_number_travail.
      ENDSELECT.
      SELECT WAID FROM CCIHT_WAH INTO lieux_de_travail WHERE RECNROOT = record_number_travail.
      ENDSELECT.
      IF NOT lieux_de_travail = 'ALOUETTE'.
        CONCATENATE lieux_de_travail description_lieux_travail INTO lieux_travail_full SEPARATED BY ' - '.
      ELSE.
        lieux_travail_full = lieux_de_travail.
      ENDIF.
    INSERT lieux_travail_full INTO TABLE table_lieux_travail_full.
    ENDLOOP.
    data:     NODE_INFO type ref to IF_WD_CONTEXT_NODE_INFO,
              NODE_INFO_ACLOC type ref to IF_WD_CONTEXT_NODE_INFO.
    NODE_INFO = WD_CONTEXT->GET_NODE_INFO( ).
    NODE_INFO_ACLOC = NODE_INFO->GET_CHILD_NODE( 'INFO_ACLOC' ).
    data:    LT_VALUESET type WDR_CONTEXT_ATTR_VALUE_LIST,
             L_VALUE type WDR_CONTEXT_ATTR_VALUE.
    valeur_int = 0.
    LOOP AT table_lieux_travail_full INTO L_VALUE-TEXT.
      ADD 1 TO valeur_int.
      MOVE valeur_int to valeur_string.
      L_VALUE-VALUE = valeur_string.
      INSERT L_VALUE into table LT_VALUESET.
    ENDLOOP.
    CLEAR valeur_int.
    NODE_INFO_ACLOC->SET_ATTRIBUTE_VALUE_SET(
         NAME = 'LIEUX'
         VALUE_SET = LT_VALUESET ).
    The values are stored in the context node "INFO_ACLOC", and cardinality 1.1/0.1, in LIEUX of type String.
    Anybody had this error before?
    Thank you!
    Brad

    Hi Thomas,
    thank you, that was it.
    I had a conversion of int to string, and the resulting string was not good.
    It looked like as a number in the debug mode, but not in the hexadecimal value.
    I did not saw it, because I'm beginning to learn abap too.
    Brad

  • Can I get metadata with SQL queries ??

    Can I get relationships between tables in MS Access using SQL statements ??

    Actually, you might be able to get what you need out of DatabaseMetaData class.
    DatabaseMetaData meta = connection.getMetaData();perhaps using:
    public ResultSet getCrossReference(String primaryCatalog,
                                       String primarySchema,
                                       String primaryTable,
                                       String foreignCatalog,
                                       String foreignSchema,
                                       String foreignTable)
                                throws SQLException
    Retrieves a description of the foreign key columns in the given foreign key table that reference the primary key columns of the given primary key table (describe how one table imports another's key). This should normally return a single foreign key/primary key pair because most tables import a foreign key from a table only once. They are ordered by FKTABLE_CAT, FKTABLE_SCHEM, FKTABLE_NAME, and KEY_SEQ.

  • SQL Queries, filter with multiple radio Buttons

    I am trying to figure out how to filter my datagridview with SQL queries so that both of them have to be met for data to show up not just one.
    My datagridview is bound to an Access Database.
    I basically would want it filtered by 'Width' and 'Wood Type'
    I have radio buttons in group boxes so a width and wood can be selected. However only one Query is applied at a time.

    Public Class Form1
    Private Sub StickersBindingNavigatorSaveItem_Click(sender As Object, e As EventArgs)
    Me.Validate()
    Me.StickersBindingSource.EndEdit()
    Me.TableAdapterManager.UpdateAll(Me.TestDataSet)
    End Sub
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    'TODO: This line of code loads data into the 'TestDataSet.Stickers' table. You can move, or remove it, as needed.
    Me.StickersTableAdapter.Fill(Me.TestDataSet.Stickers)
    AcceptButton = Button1
    End Sub
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    End Sub
    Private Sub RadioButton1_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton1.CheckedChanged
    Try
    Me.StickersTableAdapter.Wood_Oak(Me.TestDataSet.Stickers)
    Catch ex As System.Exception
    System.Windows.Forms.MessageBox.Show(ex.Message)
    End Try
    End Sub
    Private Sub RadioButton2_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton2.CheckedChanged
    Try
    Me.StickersTableAdapter.Wood_Walnut(Me.TestDataSet.Stickers)
    Catch ex As System.Exception
    System.Windows.Forms.MessageBox.Show(ex.Message)
    End Try
    End Sub
    Private Sub RadioButton3_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton3.CheckedChanged
    Try
    Me.StickersTableAdapter.Width14(Me.TestDataSet.Stickers)
    Catch ex As System.Exception
    System.Windows.Forms.MessageBox.Show(ex.Message)
    End Try
    End Sub
    Private Sub RadioButton4_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton4.CheckedChanged
    Try
    Me.StickersTableAdapter.Width18(Me.TestDataSet.Stickers)
    Catch ex As System.Exception
    System.Windows.Forms.MessageBox.Show(ex.Message)
    End Try
    End Sub
    Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
    If RadioButton5.Checked = True Then
    If TextBox1.Text = "" Then
    Else
    Me.StickersBindingSource.Filter = "Width LIKE '" & TextBox1.Text & "%'"
    DataGridView1.Refresh()
    End If
    ElseIf RadioButton6.Checked = True Then
    If TextBox1.Text = "" Then
    Else
    Me.StickersBindingSource.Filter = "[Wood Type] LIKE '" & TextBox1.Text & "%'"
    DataGridView1.Refresh()
    End If
    ElseIf RadioButton5.Checked = False And RadioButton6.Checked = False Then
    MsgBox("Please Select a Search Criteria")
    End If
    End Sub
    Private Sub TextBox2_TextChanged(sender As Object, e As EventArgs) Handles TextBox2.TextChanged
    Try
    Me.StickersTableAdapter.SearchWood(Me.TestDataSet.Stickers)
    Catch ex As System.Exception
    System.Windows.Forms.MessageBox.Show(ex.Message)
    End Try
    End Sub
    End Class

  • Recursive Java programming method for executing recursive SQL queries

    Anybody has a Java/JDBC example method to execute recursive SQL queries and print results? The method has to work for any number of queries and levels and the first query passes the parameter to the second query.
    Edited by: user4316962 on Jun 12, 2011 1:59 PM

    user4316962 wrote:
    Guys, the problem what I am trying to solve is much more complex and I don’t think SQL level recursion is enough. I am looking for Java solution with SQL queries in it to make it more flexible and DB independent.
    If you want to do recursion in SQL then it has nothing to do with Java.
    And if you want to do recursion in Java then the idiom itself has nothing to do with SQL.
    Other than that you have provided enough detail for anyone to even guess at what you are asking.
    As a start I am not even sure that you understand what recursion is nor how JDBC works. (But it could be that you are using the terms to mean something else.)
    And looking at your original post it could be nothing more than that you are looking for a design pattern - perhaps the interpreter.

  • Sql query writing best practises

    HI forum,
    Any body is having a tutorial on sql query writing best practises...pls share with me
    Thanks

    For example:
    [url http://download.oracle.com/docs/cd/B19306_01/server.102/b14211/toc.htm]Oracle Database Performance Tuning Guide 10g Release 2 (10.2)
    [url http://people.aapt.net.au/roxsco/tuning/]Oracle SQL Tuning Guide
    Gints Plivna
    http://www.gplivna.eu

  • A good book to practise SQL queries

    Hi all,
    Does any one know a good book/websource to master/practise sql queries especially complex joins?
    If yes please let me know.
    thanks
    Rajiv

    http://www.bookpool.com/sm/0977671542
    Plenty of complex joins there: Counting with theta joins (as opposed to analytics), self joins, set containment joins (aka relational division)...

  • Erratic Report Region Behavior with Dynamic SQL Queries

    I'm running HTMLDB v 1.5.1.00.12 and I've noticed some odd behavior with report regions using dynamic SQL queries. Every so often, our testers will run a page containing a dynamic sql report region and get the following error, (despite the fact the query was working only moments ago and no other developer has touched it):
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    or sometimes
    failed to parse SQL query:ORA-01403: no data found
    The only solution I've found so far is to:
    1) Make a copy of the failed report region.
    2) Disable or delete the original failed report region.
    The new copy of the report region runs without issue.
    My search of the forums turned up the following two threads, but neither provided me with a clear explanation of the cause, and how to avoid it:
    ORA-06502:PL/SQL: numeric or value error: character string buffer too small
    Re: Import Export Error (ORA-06502)
    The columns being returned are below the 4000 character limit, and the rows being returned are far less than 32k in size.
    Could this have anything to do with the way HTMLDB is internally storing the PL/SQL used to generate the dynamic SQL Query? Is there any known issue related to this with that version of HTMLDB?
    This problem occurs without any discernable pattern or consistency, making it hard to determine where I should focus my efforts in tracking down the cause.

    Hi all,
    My report seems to be behaving correctly once i set it to "Use Generic Column Names (parse query at runtime only)" :)
    Cheers,
    Joel

  • Best Practises with ACS Replication & external databases

    I am looking for a best practise with the following scenario:
    2 ACS Servers in 2 separate locations, each providing mutual backup to each other - i.e. all devices/users in Site X point to local ACS Server X 1st and remote ACS Server Y 2nd. In Site Y the devices/users point to the local ACS Server Y 1st and remote ACS Server X 2nd. This works fine; currently Server X replicates the Database to Server Y.
    In the future we will be implementing a remote LDAP database and will forward unknown users to this database for authentication. As I understand it if an unknown user exists on the LDAP database then the ACS Server will create a local account (depending the mapping policy etc) and point the password at the remote LDAP server. If we replicate from Server X to Server Y, but Server Y has created an account for an unknown user will this get deleted on replication? Is there a best practise to handle this scenario?
    Andy

    I could not find a best practices document as such but a lot of ground is covered in the document 'CiscoSecure Database Replication' at http://www.cisco.com/univercd/cc/td/doc/product/access/acs_soft/csacs4nt/acs33/user/sad.htm#wp755988.

Maybe you are looking for