Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today!
  #1  
Old May 3rd, 2004, 08:49 AM
JasonBracy JasonBracy is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 3 JasonBracy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Oracle Views Driving me crazy Please HELP !!!!

Ok here is my delema, I need to create views for my tables in a course I am taking I have have fought with I have the following defined.

create or replace type addr_ty as object
( Street VARCHAR2(35),
City VARCHAR2(25),
State VARCHAR2(2),
Zip_Code VARCHAR2(5));
/


CREATE TABLE PROPERTY (
PROPERTY_ID VARCHAR2(6),
Listing_Agent VARCHAR2(6) NOT NULL,
Residence_Type VARCHAR2(2) NOT NULL
CHECK (Residence_Type in ('SF', 'CD', 'TH', 'DP')),
New_Property CHAR(1) NOT NULL
CHECK(New_Property='Y' or New_Property='N'),
Existing_Property CHAR(1) NOT NULL
CHECK(Existing_Property='Y' or Existing_Property='N'),
Listing_Price NUMBER(38) NOT NULL,
Num_bedrooms NUMBER NULL,
Num_Bathrooms NUMBER NULL,
SQ_ft NUMBER NULL,
Sold CHAR(1) NULL,
Date_Created TIMESTAMP(6) NOT NULL,
Date_Modified TIMESTAMP(6) NOT NULL,
Location Addr_ty,
CONSTRAINT pk_PROPERTY PRIMARY KEY (PROPERTY_ID),
CONSTRAINT fk_PROPERTY1 FOREIGN KEY (Listing_Agent)
REFERENCES AGENT (AGENT_ID)
ON DELETE CASCADE);


And I am tring to create the following view but keep getting an error saying the column doesn't exist. Every time I execute the following in SQL+

CREATE OR REPLACE VIEW Available_Properties_OV AS
SELECT P.Property_id,
P.Listing_agent, P.Residence_Type, P.New_Property, P.Existing_Property, P.Listing_Price, P.Num_bedrooms,
P.Num_Bathrooms, P.SQ_ft, P.sold, P.Date_created, P.Date_modified,
addr_ty(P.street, P.City, P.State, P.Zip_Code)
From Property P
Where Sold is NULL
order by P.Location.State, P.Listing_Price;


-----------------------------------------
addr_ty(P.street, P.City, P.State, P.Zip_Code)
*
ERROR at line 5:
ORA-00904: invalid column name

but as you can see from above it exists in my type......

Reply With Quote
  #2  
Old May 5th, 2004, 03:38 AM
syorin syorin is offline
Chris
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 4 syorin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hi There,

try giving the type a column alias such as

addr_ty(P.street, P.City, P.State, P.Zip_Code) addr_type

Regards

Chris

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > Oracle Views Driving me crazy Please HELP !!!!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway