Skip Headers
Oracle® Objects for OLE Developer's Guide
11g Release 2 (11.2) for Microsoft Windows

Part Number E12245-01
Go to Documentation Home
Go to Book List
Book List
Go to Table of Contents
Go to Index
Go to Feedback page
Contact Us

Go to previous page
Go to next page
View PDF


Applies To

OraField Object


Returns the original column name used in the SELECT statement in the dynaset (as opposed to the name of the field as it appears on the server returned by the Name property). Not available at design time and read-only at run time.


field_name = Orafield.OriginalName


The orafield.OriginalName method returns the name of the specified OraField object. This returns the Original column name specified in the SQL statement during dynaset creation. This property is useful when a SQL statement contains 'schema.table.col' as the Name of the field. It enables duplicate column names to be referenced. (Duplicate column names can be avoided by using aliases in the SQL statement.)


The following example shows the use of the OriginalName property. Copy and paste this code into the definition section of a form. Then, press F5.

Sub Form_Load ()
 'Declare variables 
 Dim OraSession As OraSession 
 Dim OraDatabase As OraDatabase 
 Dim OraDynaset As OraDynaset 
 Dim OraFields As OraFields
 'Create the OraSession Object.
 Set OraSession = CreateObject("OracleInProcServer.XOraSession")
 'Create the OraDatabase Object by opening a connection to Oracle.
 Set OraDatabase = OraSession.OpenDatabase("ExampleDb", "scott/tiger", 0&)
 Set OraDynaset = OraDatabase.CreateDynaset("select scott.emp.deptno," & _ 
    "dept.deptno from scott.emp, scott.dept where dept.deptno = emp.deptno", 0&)
 Set OraFields = OraDynaset.Fields
 'Returns "DEPTNO"  
 MsgBox OraFields(0).Name   
 'Returns "scott.emp.deptno" 
 MsgBox OraFields(0).OriginalName   
 'Returns "dept.deptno" 
 MsgBox OraFields(1).OriginalName  
End Sub