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

E17727-04
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub

OriginalName

Applies To

OraField Object

Description

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.

Usage

field_name = Orafield.OriginalName

Remarks

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.)

Examples

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