Skip to content

Instantly share code, notes, and snippets.

View jon-dixon's full-sized avatar

Jon Dixon jon-dixon

View GitHub Profile
WITH old_structure AS (
SELECT struct.node_id
, struct.parent_node_id AS parent_id
, struct.is_leaf_flag AS is_leaf
, CASE WHEN node.node_name = node.node_code THEN node.node_name ELSE node.node_name || ' [' || node.node_code || ']' END AS label
FROM apx_rdm_hierarchy_structure struct
, apx_rdm_hierarchy_node node
WHERE struct.hierarchy_version_id = :P514_HIERARCHY_VERSION_ID
AND struct.node_id = node.node_id
AND node.segment_type_id = :P514_SEGMENT_TYPE_ID),
import sys
import os
import argparse
import requests
import json
from datetime import datetime
import base64
def validate_response_items(resp_json: dict, log_handle) -> bool:
"""Iterate through the 'items' array in the response and validate each item.
@jon-dixon
jon-dixon / save_note_bg.sql
Created December 16, 2023 14:18
RTE AutoSave PL/SQL Ajax Callback PL/SQL Procedure
PROCEDURE save_note_bg
(p_note_id IN cnnt_notes.note_id%TYPE,
p_old_checksum IN VARCHAR2,
p_note_array IN wwv_flow_global.vc_arr2) IS
l_new_checksum VARCHAR2(100);
l_current_checksum VARCHAR2(100);
l_note_content cnnt_notes.note_content%TYPE;
BEGIN
@jon-dixon
jon-dixon / rte_auto_save_fn_global_var_declaration.js
Last active December 16, 2023 14:00
RTE AutoSave Function and Global Variable Declaration
var iteration = 0;
// Javascript Interval used to call the function saveNote every X seconds.
var saveInterval = null;
// Page item used to store how many Milliseconds to wait
// between checks to see if the RTE field has changed.
var saveIntervalMS = $v("P50_SAVE_INTERVAL_MS");
// The maximum number of times we should check for changes.
// Between these two values we could say chek for changes every
// 30 seconds and stop after an hour.
var saveIterations = $v("P50_SAVE_ITERATIONS");
@jon-dixon
jon-dixon / CN_MDM_UTL_PKB.sql
Last active December 4, 2023 01:02
Sample code to call a REST API to Get Changed Items
create or replace PACKAGE BODY CN_MDM_UTL_PK AS
GC_SCOPE_PREFIX CONSTANT VARCHAR2(100) := 'cn.mdm.'||LOWER($$plsql_unit) || '.';
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
PROCEDURE sync_changed_items (p_last_sync_time VARCHAR2) IS
CURSOR cr_changed_items (cp_items_json IN CLOB) IS
SELECT jt.*
@jon-dixon
jon-dixon / cnHelpUtil.js
Created October 9, 2023 00:00
JS Function to Detect Clicked Help Source and Call Server Process to get Help Text
/**
* @namespace var cnHelpUtil = {};
**/
var cnHelpUtil = {};
/**
* @function showHelp
* @example cnHelpUtil.showHelp(this, 'ITEM');
**/
cnHelpUtil.showHelp = function (theEvent, helpTrigger) {
@jon-dixon
jon-dixon / APEX_CUSTOM_ITEM_HELP.sql
Last active October 9, 2023 00:14
Custom APEX Help PLSQL
CREATE OR REPLACE PACKAGE BODY DEMO.CN_CUSTOM_HELP_PK AS
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
FUNCTION get_page_item_help_key
(p_page_item_id IN apex_application_page_items.item_id%TYPE) RETURN custom_apex_help_text.help_key%TYPE IS
l_help_key apex_application_page_items.item_help_text%TYPE;
BEGIN
@jon-dixon
jon-dixon / cnUtil.js
Created March 28, 2023 14:30
APEX Dynamic Inline Help Utility Function
/**
* @namespace var cnUtil = {};
**/
var cnUtil = {};
/**
* @function setInlineHelp
* @example cnUtil.setInlineHelp('P3_JUSTIFICATION', 'Hello World');
**/
cnUtil.setInlineHelp = function (itemID, inLineHelpText) {
@jon-dixon
jon-dixon / TABLE_FN_PK.sql
Last active March 14, 2023 21:39
Pipelined Table Function Blog Example
CREATE OR REPLACE PACKAGE TABLE_FN_PK AUTHID DEFINER AS
-- Record Type used to define columns for the pipelined output.
TYPE rec_evs_sold IS RECORD
(year_sold ev_sales_by_year.data_year%TYPE,
make ev_sales_by_year.make%TYPE,
vehicles_sold NUMBER,
top_model ev_sales_by_year.model%TYPE,
top_model_pct NUMBER);
@jon-dixon
jon-dixon / APEX_STRING_PLIST.sql
Last active February 8, 2023 19:22
Working with Lists APEX_STRING.PLIST
DECLARE
CURSOR cr_tasks IS
SELECT task_id
, task_owner
FROM cndemo_tasks;
lt_owner_task_count apex_t_varchar2;
l_task_count NUMBER;
BEGIN
-- Loop through all tasks.
FOR task_rec IN cr_tasks LOOP