Create a View in Oracle with SQL -


i trying create view has both strsuppliername column tblsuppliers table strproductname column tblproducts table, , have been having trouble. appreciated.

create table  "tblsuppliers"     (    "lngsupplierid" varchar2(100) not null enable,      "strsuppliername" varchar2(100) not null enable,      "strsupplieraddressstreet" varchar2(200) not null enable,      "strsupplieraddresscity" varchar2(150) not null enable,      "strsupplieraddresscountry" varchar2(100) not null enable,      "strsupplieraddresspostcode" varchar2(25),      "strsupplierphoneno" varchar2(15) not null enable,      "strsupplierfaxno" varchar2(20),      "strpaymentterms" varchar2(500),       constraint "tblsuppliers_pk" primary key ("lngsupplierid") enable    ) ;  create or replace trigger  "bi_tblsuppliers"    before insert on "tblsuppliers"                  each row   begin      if :new."lngsupplierid" null      select "tblsuppliers_seq".nextval :new."lngsupplierid" dual;    end if;  end;    create table  "strproducts"     (    "lngproductid" varchar2(100) not null enable,      "strproductname" varchar2(100) not null enable,      "chkinstock" varchar2(5) not null enable,      "lngunitsinstock" number(38,0) not null enable,      "curproductunitpurchaseprice" varchar2(10),      "curproductunitsaleprice" varchar2(10),      "lngsupplierid" varchar2(100),       constraint "tblproducts_pk" primary key ("lngproductid") enable    ) ;  alter table  "tblproducts" add foreign key ("lngsupplierid")       references  "tblsuppliers" ("lngsupplierid") enable;  create or replace trigger  "bi_tblproducts"    before insert on "tblproducts"                  each row   begin      if :new."lngproductid" null      select "tblproducts_seq".nextval :new."lngproductid" dual;    end if;  end;   / alter trigger  "bi_tblproducts" enable; 

is you're looking for?

create view "yourviewname" select  p."lngproductid",  p."strproductname",  s."lngsupplierid",  s."strsuppliername" "strproducts" p inner join "tblsuppliers" s on s."lngsupplierid" = p."lngsupplierid" 

Comments

Popular posts from this blog

python - Mongodb How to add addtional information when aggregating? -

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

ruby - Net::HTTP extremely slow responses for HTTPS requests -