Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Creating view with variable table

3390240Feb 3 2017 — edited Feb 8 2017

I have a view below

create or replace view Slm_caritoplam2 as

Select Clcard.Parentclref,

       Clcard2.Code,

       Clcard2.Definition_,

      

       Sum(Gntotcl.Debit - Gntotcl.Credit) As Toplam

  From Lg_001_Clcard     Clcard,

       Lg_001_Clcard     Clcard2,

       Lg_001_01_Gntotcl Gntotcl

Where Gntotcl.Cardref = Clcard.Logicalref

   And Gntotcl.Tottyp = 1

   And Gntotcl.Debit - Gntotcl.Credit != 0

   And Clcard.Parentclref = Clcard2.Logicalref

   And Clcard.Parentclref != 0

   and clcard.active = 0

Group By Clcard.Parentclref, Clcard2.Code, Clcard2.Definition_

Order By Clcard.Parentclref;

Lg_001 references the main company. There are 20+ companies in the system, all having tables Lg_002, Lg_003 etc.

Is there a way to create a dynamic view inorder not to create a separate one for each company ?

Thanks for the help

This post has been answered by James Su on Feb 3 2017
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 6 2017
Added on Feb 3 2017
19 comments
1,441 views