{"id":1219,"date":"2016-06-08T07:24:13","date_gmt":"2016-06-08T07:24:13","guid":{"rendered":"http:\/\/codethataint.com\/blog\/?p=1219"},"modified":"2016-06-08T07:25:21","modified_gmt":"2016-06-08T07:25:21","slug":"generating-unique-next-id-in-process","status":"publish","type":"post","link":"https:\/\/codethataint.com\/blog\/generating-unique-next-id-in-process\/","title":{"rendered":"Generating Unique Next ID in Process"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/codethataint.com\/blog\/wp-content\/uploads\/2016\/06\/ProcessIdGeneration.png\" alt=\"\" height=\"249\" width=\"273\"\/><\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\nFOR cur IN (SELECT  process_Id \r\n              FROM  tbl_process)\r\nLOOP\r\n  SELECT (MAX(TO_NUMBER(substr(p.old_id, instr(p.old_id, '_', -1) + 1))))\r\n    INTO new_id\r\n    FROM tbl_process p\r\n   WHERE process_Id = cur.process_Id;\r\n\r\n  IF new_id IS NULL THEN\r\n    new_id := cur.process_Id || '_1';\r\n  ELSE\r\n    new_id := new_id + 1;\r\n    new_id := cur.process_Id || '_' || new_id;\r\n  END IF;\r\nEND LOOP;\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>FOR cur IN (SELECT process_Id FROM tbl_process) LOOP SELECT (MAX(TO_NUMBER(substr(p.old_id, instr(p.old_id, &#8216;_&#8217;, -1) + 1)))) INTO new_id FROM tbl_process p WHERE process_Id = cur.process_Id; IF new_id IS NULL THEN new_id := cur.process_Id || &#8216;_1&#8217;; ELSE new_id := new_id + 1; new_id := cur.process_Id || &#8216;_&#8217; || new_id; END IF; END LOOP;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[29],"tags":[],"class_list":["post-1219","post","type-post","status-publish","format-standard","hentry","category-oracle-database-2"],"_links":{"self":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/1219","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/comments?post=1219"}],"version-history":[{"count":2,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/1219\/revisions"}],"predecessor-version":[{"id":1222,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/1219\/revisions\/1222"}],"wp:attachment":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/media?parent=1219"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/categories?post=1219"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/tags?post=1219"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}