Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
integration:rdbms:oracle:tables [2011/04/04 03:32]
doc
integration:rdbms:oracle:tables [2016/06/28 22:38] (current)
Line 20: Line 20:
  
 ==== Tables ==== ==== Tables ====
 +
 +=== The CREATE TABLE Statement ===
  
 The [[dev:​sql:​statements:​create_table:​home|CREATE TABLE]] statement is used to declare an Oracle table or view within an Omnidex Environment File.  The Omnidex Environment File will contain a declaration for each Oracle table or view to be accessed, and will correlate all of the schema information between Omnidex and Oracle, including object names and datatypes. This statement can either be issued directly, or it can be extracted from Oracle using the EXTRACT statement as discussed in the previous section. The [[dev:​sql:​statements:​create_table:​home|CREATE TABLE]] statement is used to declare an Oracle table or view within an Omnidex Environment File.  The Omnidex Environment File will contain a declaration for each Oracle table or view to be accessed, and will correlate all of the schema information between Omnidex and Oracle, including object names and datatypes. This statement can either be issued directly, or it can be extracted from Oracle using the EXTRACT statement as discussed in the previous section.
Line 37: Line 39:
 </​code>​ </​code>​
  
-In the Omnidex declaration,​ note that the PHYSICAL clause for table points to the Oracle syntax of //​user.table//​. ​ Also note that the columns use the PHYSICAL clause to point to the underlying Oracle column name, and use Omnidex datatypes rather than Oracle datatypes. 
  
 **Omnidex CREATE TABLE Statement** **Omnidex CREATE TABLE Statement**
Line 53: Line 54:
  ​in ​                  "​simple.xml";​  ​in ​                  "​simple.xml";​
 </​code>​ </​code>​
 +
 +=== Using the Table and Column PHYSICAL Clauses ===
 +
 +In the Omnidex declaration,​ note that the optional PHYSICAL clause for the table allows Omnidex to have a different table name than Oracle. This is most commonly used to allow a //​user.table//​ designation for the Oracle table, but can also be used when administrators wish a different name in the Omnidex environment or need to shorten a table name to meet the 32-character limit in Omnidex. ​ If the PHYSICAL clause is not present, Omnidex assumes that the table names are the same between Omnidex and Oracle.
 +
 +Column declarations can similarly use a PHYSICAL clause to allow Omnidex to have a different column name than Oracle.  ​
  
 === Modifying Omnidex'​s View of the Oracle Data Objects === === Modifying Omnidex'​s View of the Oracle Data Objects ===
Line 58: Line 65:
 When Omnidex accesses a table, it only knows about the data objects that are declared in the Omnidex Environment File.  It does not have an independent understanding of the Oracle environment. ​ This allows administrators to shape the Omnidex Environment the way they want.  Some of the opportunities this provides are: When Omnidex accesses a table, it only knows about the data objects that are declared in the Omnidex Environment File.  It does not have an independent understanding of the Oracle environment. ​ This allows administrators to shape the Omnidex Environment the way they want.  Some of the opportunities this provides are:
  
-  * Omnidex can have a controlled view of the Oracle database, limited to only the tables ​and  ​columns that the application requires.+  * Omnidex can have a controlled view of the Oracle database, limited to only the tables ​that the application requires. ​ Similarly, administrators can choose to include only the columns ​for each table that the application requires.
   * Omnidex tables can point to Oracle views, allowing an easy approach to reshaping the application'​s view of the data.   * Omnidex tables can point to Oracle views, allowing an easy approach to reshaping the application'​s view of the data.
 +  * Omnidex can use different names for tables and columns by using the PHYSICAL clause in the TABLE or COLUMN sections of the CREATE TABLE statement to map to the underlying Oracle names.
   * Omnidex columns can often be assigned datatypes that differ from the Oracle datatype. ​ Character-class datatypes can be interchanged,​ allowing applications to easily receive the datatype that works best for its needs. ​ Binary datatypes can be assigned to any of the integer or floating point datatypes; in fact, this is a necessity since Oracle'​s NUMBER datatype is only an internal datatype.  ​   * Omnidex columns can often be assigned datatypes that differ from the Oracle datatype. ​ Character-class datatypes can be interchanged,​ allowing applications to easily receive the datatype that works best for its needs. ​ Binary datatypes can be assigned to any of the integer or floating point datatypes; in fact, this is a necessity since Oracle'​s NUMBER datatype is only an internal datatype.  ​
   * Omnidex tables can include [[admin:​features:​expressioncols:​home|Expression-based Columns]], which are columns derived from a SQL expression rather than a specific column in the underlying database.   * Omnidex tables can include [[admin:​features:​expressioncols:​home|Expression-based Columns]], which are columns derived from a SQL expression rather than a specific column in the underlying database.
Line 67: Line 75:
 Omnidex table declarations can reference Oracle Views. ​ Omnidex will retrieve from the Oracle view just as though it is a table. ​ Oracle Views can be used to provide different views of the data, appropriate for the application. Omnidex table declarations can reference Oracle Views. ​ Omnidex will retrieve from the Oracle view just as though it is a table. ​ Oracle Views can be used to provide different views of the data, appropriate for the application.
  
-When referencing an Oracle view, it is necessary to declare a UNIQUEKEY ​constraint. ​ The UNIQUEKEY ​constraint tells Omnidex how to uniquely identify a row.  When Omnidex retrieves individual rows, it will use this unique value; therefore, it is important that access to this column (or columns) be properly indexed in the underlying table.  ​+When referencing an Oracle view, it is necessary to declare a UNIQUE ​constraint.  This requirement for the UNIQUE constraint is independent of any PRIMARY or FOREIGN constraints,​ discussed in the next page.  The UNIQUE ​constraint tells Omnidex how to uniquely identify a row.  When Omnidex retrieves individual rows, it will use this unique value; therefore, it is important that access to this column (or columns) be properly indexed in the underlying table.  ​
  
 **Oracle CREATE VIEW Statement** **Oracle CREATE VIEW Statement**
Line 80: Line 88:
    ​REGION_CD,​    ​REGION_CD,​
    ​COUNTRY_CD,​    ​COUNTRY_CD,​
-   ​TAX_RATE+   ​TAX_RATE
-   ​constraint STATE_PK primary key (STATE_CD) rely disable novalidate ​+
  ) as   ) as 
    ​select C.DESCRIPTION,​    ​select C.DESCRIPTION,​
Line 94: Line 101:
    ​where ​ S.COUNTRY_CD = C.COUNTRY_CD;​    ​where ​ S.COUNTRY_CD = C.COUNTRY_CD;​
 </​code>​ </​code>​
- 
-The following Omnidex table declaration references the Oracle view.  Note the presence of the UNIQUE constraint. 
  
 **Omnidex CREATE TABLE Statement** **Omnidex CREATE TABLE Statement**
 
Back to top
integration/rdbms/oracle/tables.1301887922.txt.gz · Last modified: 2016/06/28 22:38 (external edit)