|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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...... ![]() |
|
#2
|
|||
|
|||
|
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 |
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > Oracle Views Driving me crazy Please HELP !!!! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|