Jump to content

Error using UNPIVOT in TIBCO TDV SQL : "UNPIVOT missing an alias"


Bob A

Recommended Posts

I am unable to get the UNPIVOT syntax to work in any SQL query in TDV Studio (TIBCO Data Virtualization).

It gives the error ""UNPIVOT missing an alias. On line 5, column 1. ""

even though I seem to have followed the syntax given in theTIB_tdv_8.4.0_ReferenceGuide.pdf --> page 65-67

The query I wrote has the form shown below.

In fact, if you run this query below in TDV Studio, you will get the error (even though this is a dummy query, the same error will still show up).

Why is the error coming What is missing or wrong in the query

-------

SELECT

col_1, col_2, col_3

FROM

tbl

UNPIVOT

(

(col_1, col_2, col_3)

FOR

seq_nbr

IN

(

(tbl.col_1_1, tbl.col_1_2, tbl.col_1_3),

(tbl.col_2_1, tbl.col_2_2, tbl.col_2_3),

(tbl.col_3_1, tbl.col_3_2, tbl.col_3_3)

)

)

------------

adding aliases to the columnsets doesn't help

SELECT

col_1, col_2, col_3

FROM

tbl

UNPIVOT

(

(col_1, col_2, col_3)

FOR

seq_nbr

IN

(

(tbl.col_1_1, tbl.col_1_2, tbl.col_1_3) as 'SET1',

(tbl.col_2_1, tbl.col_2_2, tbl.col_2_3) as 'SET2',

(tbl.col_3_1, tbl.col_3_2, tbl.col_3_3) as 'SET3'

)

)

------------

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...