Database Administration (MOSC)

MOSC Banner

Convert NVARCHAR2 to VARCHAR2 in an Oracle View

edited Mar 6, 2015 10:02AM in Database Administration (MOSC) 3 commentsAnswered

Using Oracle 12c.

I'm trying to create an Oracle view which is pulling information from SQL Server tables. The view works, but the SQL Server columns are displaying as NVARCHAR2 data types, and I need them to be VARCHAR2.

I've tried both the CAST and TO_CHAR in the view but the view does not like them. The select statement on it's own works with TO_CHAR.

CREATE OR REPLACE FORCE VIEW HANSEN_HYDRANTS AS

     SELECT

          C.HYDRANT_ID,

          C.CAPTURE_TYPE,

          A.ADDRKEY,

          TO_CHAR(A.COLOR),

          A.COMPKEY,

          A.ADDRQUAL AS LOCATION,

          B.CASTNO AS STREET_NUMBER,

          B.CASTNAME AS STREET_NAME,

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center