Update fields with random numbers in Oracle----Insert data from one table into another table----environment settings

Source: Internet
Author: User
Tags one table

DECLARE        CURSORRecordcursor is               SELECTLongitude,latitude fromWr_wiust_b_sec for UPDATE; Recordrow recordcursor%ROWTYPE;BEGIN        OPENRecordcursor; LOOPFETCHRecordcursor intoRecordrow; IFRecordcursor%NOTFOUND Then                   EXIT; ELSE                   UPDATEWr_wiust_b_secSETLongitude=(SelectSUBSTR (To_char (Dbms_random.value ()*(116.280858-108.362376)+108.362376),0,Ten) fromdual), Latitude=(SelectSUBSTR (To_char (Dbms_random.value ()*(33.257267-29.040321)+29.040321),0,Ten) fromdual)WHERE  Current  ofRecordcursor; END IF; ENDLOOP; COMMIT; CLOSERecordcursor;END;Commit;

Insert  intoSt_pptn_r_temp (STCD, TM, DRP, INTV, PDR, DYP, wth,datetime)(Select distinctT.STCD, T.tm, T.DRP, T.intv, T.PDR, T.dyp, T.wth, T.datetime  fromSt_pptn_r TInner JoinSt_stbprp_b_temp B onB.stcd=T.stcdwhereT.tm>=To_date ('2014-05-01 08:00:00','YYYY-MM-DD Hh24:mi:ss') andT.tm<=To_date ('2014-10-01 08:00:00','YYYY-MM-DD Hh24:mi:ss') );Insert  intost_river_r_temp (STCD, TM, Z, Q, Xsa, XSAVV, XSMXV, FLWCHRCD, WPTN, MSQMT, Msamt, MSVMT) (Select distinctT.STCD, T.tm, T.z, T.Q, T.xsa, T.XSAVV, T.XSMXV, T.FLWCHRCD, T.WPTN, T.MSQMT, T.msamt, T.MSVMT fromSt_river_r TInner JoinSt_stbprp_b_temp B onB.stcd=T.stcdwhereT.tm>=To_date ('2014-05-01 08:00:00','YYYY-MM-DD Hh24:mi:ss') andT.tm<=To_date ('2014-10-01 08:00:00','YYYY-MM-DD Hh24:mi:ss') );Insert  intost_rsvr_r_temp (STCD, TM, RZ, Inq, W, Blrz, OTQ, RWCHRCD, RWPTN, INQDR, MSQMT) (Select distinctR.STCD, R.tm, R.rz, R.inq, R.W, R.blrz, R.OTQ, R.RWCHRCD, R.RWPTN, R.INQDR, R.MSQMT fromSt_rsvr_r RInner JoinSt_stbprp_b_temp B onB.stcd=R.stcdwhereR.tm>=To_date ('2014-05-01 08:00:00','YYYY-MM-DD Hh24:mi:ss') andR.tm<=To_date ('2014-10-01 08:00:00','YYYY-MM-DD Hh24:mi:ss') );

 1  . Languages and encodings  2   time format  1   with alter session >  alter  session set  Nls_date_format=   " yyyy-mm-dd hh24 : Mi:ss   " ;  2   in the OS set  Nls_date_format=  yyyy- mm- DD HH24:MI:SS 

Update fields with random numbers in Oracle----Insert data from one table into another table----environment settings

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.