Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 8912

update table dynamically using stored procedure/scripting calculation view

$
0
0

Hi Everyone,

 

Can we update table dynamically using stored procedure/scripting calculation view

 

Ex:      CUSTOMER_DIM (Raw table)

 

           CUSTOMER_ID,ORDER_ID IS A           COMPOSITE PRIMARY KEY,

            PRODUCTION_QTY                              DEFAULT VALUE SET 0

            NET_PRICE                                         DEFAULT VALUE SET 0.0

            RATE_MARGIN                                    DEFAULT VALUE SET 0.0

 

 

one of the scripted calculation view "CAL_CUST_ORDER_VIEW" is built (by making use of other tables,without using CUSTOMER_DIM) and arived to get

CUSTOMER_ID,ORDER_ID,PRODUCTION_QTY data.

 

 

i want to update raw table CUSTOMER_DIM using "CAL_CUST_ORDER_VIEW" view by satisfying condition of

CUSTOMER_DIM.CUSTOMER_ID = CAL_CUST_ORDER_VIEW.CUSTOMER_ID and CUSTOMER_DIM.ORDER_ID = CAL_CUST_ORDER_VIEW.ORDER_ID

dynamically.

 

 

manually i can write using update syntax with inner join (considering table, view from _SYS_BIC) using where clause.

practical scenario is that every day when new data comes for (calculation view) "CAL_CUST_ORDER_VIEW"

automatically CUSTOMER_DIM has to get updated..

 

 

we cannot write update statement inside scripting calculation view?  ( i think calculation view is read only)

for this can we write update statement inside the stored procedure but how to exec that stored procedure dynamically.

can we call stored procedure inside calculation view?

 

Please guide me to resolve this issue.

 

 

Ex: considering small amount of data to know the flow

Raw table---> data

 

CUSTOMER_DIM

customer_id    order_id     Production_qty        Net_price       rate_margin

00010121           KOI9087          0                         0.0                     0.0

00010122           KHI9087          0                         0.0                     0.0

00020122           KHI9187          0                         0.0                     0.0

00024122           KHI9177          0                         0.0                     0.0

 

 

calculation view data  (Production_qty (calculated measure)  value is derived from the logic basis)

 

customer_id  order_id    Production_qty   Net_price       rate_margin

00010121      KOI9087     8740               0.0                0.0

00010122      KHI9087     2500               0.0                0.0

00020122      KHI9187     5000               0.0                0.0

00024122      KHI9177     8800               0.0                0.0

 

 

after update statement written manually

raw_table must updated with

customer_id  order_id    Production_qty   Net_price       rate_margin

00010121      KOI9087     8740               0.0                0.0

00010122      KHI9087     2500               0.0                0.0

00020122      KHI9187     5000               0.0                0.0

00024122      KHI9177     8800               0.0                0.0

 

How to do it dynamically  "calling the update statement" (using stored proc/calculation view)

 

Thanks,

Thara.


Viewing all articles
Browse latest Browse all 8912

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>