Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL View I do not Undersstand

Status
Not open for further replies.

RachelK

Programmer
Mar 18, 2002
171
GB
I am looking at a view created in oracle I do not understand why there are lots of 123456789 can some one please explain ?

Here is part of the view :-{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0 Arial;}}
\viewkind4\uc1\pard\f0\fs20 SELECT COMPANY, DRAFT_JOB, CENTRE, PERIOD_NO,TRANS_TYPE, AMOUNT, INFLATION_FACTOR, 'FCSTTIME', 123456789, 123456789, 123456789, 123456789, 123456789,\par
123456789, 123456789, 123456789, 123456789, 123456789, 123456789, 123456789, 123456789, 123456789, CHARGE_AMOUNT, WORK_STAGE, 123456789, 123456789, 123456789, 123456789, 123456789, 123456789, 123456789, 123456789, 123456789, 123456789, \par
123456789, 123456789, 123456789, 123456789, 123456789 FROM PFBTIME\par
UNION ALL\par
SELECT COMPANY, DRAFT_JOB, CENTRE, PERIOD_NO, TRANS_TYPE, AMOUNT, INFLATION_FACTOR, 'FCSTDISB', 123456789, 123456789, 123456789, 123456789, 123456789, 123456789, 123456789, 123456789, 123456789, 123456789, 123456789, 123456789, \par
123456789, 123456789, CHARGE_AMOUNT, WORK_STAGE, 123456789, 123456789, 123456789, 123456789, 123456789, 123456789, 123456789, 123456789,\par
123456789, 123456789, 123456789, 123456789, 123456789, 123456789, 123456789 FROM (SELECT P.COMPANY, DRAFT_JOB, CENTRE, PERIOD_NO, TRANS_TYPE, AMOUNT,\par
INFLATION_FACTOR, 'FCSTDISB', 123456789, 123456789, 123456789, 123456789, 123456789, 123456789, 123456789, 123456789, 123456789, 123456789, 123456789, 123456789, \par
123456789, 123456789, CHARGE_AMOUNT, WORK_STAGE, 123456789, 123456789, 123456789, 123456789, 123456789, 123456789, 123456789, 123456789, \par
123456789, 123456789, 123456789, 123456789, 123456789, 123456789, 123456789 FROM PFBDISB P, JCJOBS J WHERE P.COMPANY = J.COMPANY AND P.DRAFT_JOB = J.JOB)\par
UNION ALL\par
}

 
It appears to be using the '123456789' part as a placeholder
so that the same # of columns are selected from each table in the union ( which is mandatory for the union to work )..


Not very clean, and probably not too efficient, but I imagine it was the only way..

hth
John G
[profile]

 
John,

Thanks for your answer. You have to excuse me I am really new to oracle. So if there are 10 colum in table number 1 and there are 25 colums in table no 2 and so on. If the 4th colum in the first table needs to be the 10 colum in the view you would put 123456789 for each colum that would not hold and information and then put
,123456789, 123456789, 123456789, 123456789, 123456789,123456789, 123456789, 123456789, 123456789, 123456789, CHARGE_AMOUNT,
So it would look for the charge amount in the table and also add the 10 colums in front of the chrage amount.

Also is a union a relationship ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top