Live ORACLE

if you are Oracle Developer ,than this Blog most likely will make you happy.

About my Blog

This Blog particularized for Oracle Developers ... you will see interesting Codes for SQL , PL/SQL as well as new ideas for Developer Suite and Client Tools that will help you in your professional life ... and I hope I reach for your satisfaction.

About Me

I'm Hany Freedom , 25 years old , I live in EL-Minia City in Egypt , I'm Moderator at ArabOUG.org the best Arabic Forum for ORACLE on the Net. if you interested to know more about me .... just Click Here.

Using SET TRANSACTION to Begin a Read-only Transaction


DECLARE

daily_order_total NUMBER(12,2);

weekly_order_total NUMBER(12,2);

monthly_order_total NUMBER(12,2);

BEGIN

COMMIT; -- ends previous transaction



SET TRANSACTION READ ONLY NAME 'Calculate Order Totals';



SELECT Sum(order_total)

INTO daily_order_total

FROM orders

WHERE order_date = SYSDATE;



SELECT Sum(order_total)

INTO weekly_order_total

FROM orders

WHERE order_date = SYSDATE - 7;



SELECT Sum(order_total)

INTO monthly_order_total

FROM orders

WHERE order_date = SYSDATE - 30;



COMMIT; -- ends read-only transaction



END;

/



Share/Save/Bookmark

0 comments:

Post a Comment



Newer Posts Older Posts Home Page
 
http://www.dpriver.com/images/sqlpp-banner-2.png

Thanks for reading my Blog ... you Visitor Number :-