User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Oracle section within the Web Development category of DaniWeb, a massive community of 402,474 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,927 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Oracle advertiser: Programming Forums

Create View syntax problem

Join Date: May 2005
Posts: 2
Reputation: pdomja is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
pdomja pdomja is offline Offline
Newbie Poster

Re: Create View syntax problem

  #2  
May 17th, 2005
I've solved it! for anyone elses info it was simply a combination of daft mistakes (see below).

I had not taken into account duplicate column names in the generated view (so I added aliases), a "time saving" copy and paste idea had resulted in the use of some incorrect table names, also I had not added AND operators when defining the joins in the WHERE clause. So the corrected statement is as follows:

CREATE VIEW LLPG AS
SELECT PR_BLPU.KEYVAL BLPU_KV, PR_BLPU.UPRN, PR_BLPU.MAP_EAST,
pr_BLPU.MAP_NORTH, PR_BLPU.LOGICAL_STATUS BLPU_STATUS,
PR_LPI.KEYVAL LPI_KV, PR_LPI.PKEYVAL LPI_PKV, PR_LPI.ST_KEYVAL LPI_SKV,
PR_LPI.ADDRESS, PR_LPI.CURRENCY_FLAG, PR_LPI.LOGICAL_STATUS LPI_STATUS,
PR_LPI.PAO_START_NO, PR_LPI.PAO_START_SFX, PR_LPI.PAO_END_NO,
PR_LPI.PAO_END_SFX, PR_LPI.PAO_DESC, PR_LPI.SAO_START_NO,
PR_LPI.SAO_START_SFX, PR_LPI.SAO_END_NO, PR_LPI.SAO_END_SFX,
PR_LPI.SAO_DESC, PR_LPI.POSTCODE, PR_LPI.POST_TOWN,
PR_LPI.OFFICIAL_ADDR,
PR_ST_DESC.KEYVAL DESC_KV, PR_ST_DESC.PKEYVAL DESC_PKV, PR_ST_DESC.STREET_NAME,
PR_ST_DESC.LOCALITY_NAME, PR_ST_DESC.TOWN_NAME,
PR_ST_DESC.COUNTY_NAME, PR_ST_DESC.TRADING_ESTATE,
PR_ST_DESC.DISTRICT_NAME, PR_ST_DESC.POSTAL_TOWN,
PR_ST_DESC.POSTAL_COUNTY,
PR_STREET.KEYVAL STREET_KV, PR_STREET.USRN
FROM PR_BLPU, PR_LPI, PR_ST_DESC, PR_STREET
WHERE
PR_BLPU.KEYVAL = PR_LPI.PKEYVAL
AND
PR_LPI.ST_KEYVAL = PR_ST_DESC.KEYVAL
AND
PR_ST_DESC.PKEYVAL = PR_STREET.KEYVAL;


I found a trial version of TOAD ( a simple SQL GUI application) really helpful in working out what was wrong.
Reply With Quote  
All times are GMT -4. The time now is 4:31 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC