Posts

Showing posts with the label plsql

Create and publish JSON via PLSQL

 BUILD JSON PROCEDURE build_Item_Out_Json(p_batch_id    IN VARCHAR2,                               x_json_resp   OUT CLOB)     AS             --cur_item_out            SYS_REFCURSOR;         v_row_count             NUMBER := 0;     BEGIN              fnd_file.put_line(fnd_file.output, 'In build_Item_Out_Json proc');          BEGIN              -- check to see if any error records exist               SELECT COUNT(*)                 INTO v_row_count                 FROM xx_item                WHERE batc...

Timestamp with milli/micro/nano seconds

Image
As part of performance and run time of a query or a function we might need to capture time in milli/micro/ nano seconds. Below snippets would help in such scenarios: By default  localtimestamp will give upto 6 decimal places of a sec. to get nano sec upto 9 decimal use  localtimestamp(9) declare l_starttime timestamp(9); l_endtime timestamp(9); l_count number:=0; l_Diff number:=0; begin select localtimestamp(9) into l_starttime from dual;  dbms_output.put_line('Start Time: ' || l_starttime);   select count(*) into l_count from PO_line_locations_all pll, po_headers_all PHA where pll.po_header_id = pha.po_header_id and exists (select 1 from po_requisition_lines_all prl,po_requisition_headers_all prh               where prl.requisition_header_id = prh.requisition_header_id                 and prl.blanket_po_header_id = pha.po_header_id) and pll.po_header_id = <enter header id>; se...