Guest User

Untitled

a guest
Nov 29th, 2017
344
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. UPDATE TABLE
  2. SET ARCH = 'XML DATA'
  3. WHERE name='xxx';
  4.  
  5. update TABLE NAME set COL NAME=xml(REPLACE(OLDXML::text,'</NODE NAME>', NEW VALUE TO UPDATE ||'</NODE NAME>')) where name='xxxx'
  6.  
  7.  
  8.  
  9.  
  10. Example.
  11. CREATE TABLE notify_test (id integer NOT NULL , notifyxml text)
  12.  
  13. select * from notify_test
  14.  
  15. insert into notify_test values(1,'<root><from>Core Integra</from><fromId>mahesh@gm.com</fromId><to></to><cc></cc><bcc></bcc><subject>Accoutn created</subject><body><![CDATA[<div class="container" style="width:800px; margin:auto;font-family: Helvetica Neue, Helvetica, Arial, sans-serif; color: #696969;font-size:14px;"><p>Dear {!User.Username}, </p> <p> Your account is created .Your login details: </p> <p> Username : {!User.Email} </p><p> Password: {!password} </p> <p style="line-height:15px;">Best Regards,</p><p>Core Integra Team</p> <img style="width:76px;height:24px;" alt="OrgUnit Small Logo" src=""></div>]]></body><replyTo /></root>')
  16.  
  17. -------------------------------------------------
  18.  
  19.  
  20. CREATE OR REPLACE FUNCTION public.usf_cic_update_templatexml(
  21. templateid integer,
  22. to_mail text,
  23. cc_mail text)
  24. returns integer as
  25. $BODY$
  26. declare xml text;
  27.  
  28. declare ccxml text;
  29.  
  30.  
  31. begin
  32. SELECT notifyxml into xml from notify_test where id =templateid;
  33. raise notice 'Value: %', to_mail;
  34. raise notice 'Value: %', cc_mail;
  35.  
  36. if to_mail!='' then
  37.  
  38. update notify_test set notifyxml=xml(REPLACE(xml::text,'</to>', to_mail ||'</to>')) where id =templateid;
  39.  
  40. if cc_mail!='' then
  41.  
  42. SELECT notifyxml into ccxml from notify_test where id =templateid;
  43. update notify_test set notifyxml=xml(REPLACE(ccxml::text,'</cc>', cc_mail ||'</cc>')) where id =templateid;
  44.  
  45. end if;
  46. end if;
  47. return 1;
  48. END
  49.  
  50. $BODY$
  51. LANGUAGE plpgsql VOLATILE
  52. COST 100;
Add Comment
Please, Sign In to add comment