Skip to content

Instantly share code, notes, and snippets.

View tschf's full-sized avatar

tschf tschf

View GitHub Profile
@tschf
tschf / gist:5606476
Created May 19, 2013 02:42
Application Express AJAX File Upload
set define off
set verify off
set feedback off
WHENEVER SQLERROR EXIT SQL.SQLCODE ROLLBACK
begin wwv_flow.g_import_in_progress := true; end;
/
-- AAAA PPPPP EEEEEE XX XX
-- AA AA PP PP EE XX XX
-- AA AA PP PP EE XX XX
@tschf
tschf / google_drive.pkb
Last active November 30, 2021 00:36
google_drive in plsql
create or replace
PACKAGE GOOGLE_DRIVE
as
type t_varchar2 is table of varchar2(50);
-- Set default folder ID to upload to (got from last portion of URL when opening folder)
g_upload_folder_id varchar2(400) := '';
procedure get_authorization_url(
@tschf
tschf / apex_session_utl.sql
Last active August 29, 2015 14:08
Package to re initialise an existing Application Express session from SQL Developer
/* Usage:
Package to get an apex session from SQL Developer (or other external tool) based on an existing session ID.
Useful to have parameterised views return data
--Get session in SQL Dev, replacing xxxxxxxxx with your actual session
begin
apex_session_utl.re_init_session('xxxxxxxxx');
end;
@tschf
tschf / SQL*Plus pipe.md
Last active January 12, 2016 19:39
Piping values to SQL*Plus script doesn't work with a HIDE accept param

Piping in input doesn't seem to work when having one HIDE param and one non-HIDE param - refer to sql script below https://gist.github.com/trent-/1c2bb55da5045113498e#file-ords_manual_install-sql

Scenario 1: Both accepts are non-HIDE.... works fine
Scenario 2: Both accepts are HIDE.... works fine
Scenario 2: At least one is HIDE and one isn't.... doesn't work
Scenario 3: Only one param (HIDE or non-HIDE doesn't matter).... works fine

Call script:

@tschf
tschf / ORDS.md
Last active August 29, 2015 14:20
Using SSH Connections for ORDS Admin

I set up the the SSH profile:

See: sshprofile.png

Then I can set up the connection by specifying the type as SSH, successfully:

See: ssh_connection_test.png

However, in the REST Admin, I don't get the SSH connection option:

@tschf
tschf / download.sql
Created August 10, 2015 21:21
Download file with wpg_docload
declare
l_file files%rowtype;
begin
select *
into l_file
from files
where id = 261;
owa_util.mime_header(l_file.mime_type);
$ /home/trent/node-v0.12.2-linux-x64/bin/node app.js dev 110
options { configFile: '/home/trent/apex-diff/config/config.json',
sqlcl: '/opt/sqlcl/bin/sql',
debug: true,
rebuildTempFile: false,
connections:
{ dev: 'dl_test/dl_test@localhost/xe',
prod: 'dl_prod/dl_prod@localhost/xe' } }
sql: { command: '%SQLCL% %CONNECTION% @%DIRECTORY%/%FILENAME% %PARAMS%',
files:
@tschf
tschf / README.md
Created August 31, 2016 23:21
Atom fresh sessions

Atom has a config not in the UI: core.restorePreviousWindowsOnStart.

Set this to false in your config.cson file in order to start Atom in a blank state when you launch Atom.

@tschf
tschf / query.sql
Created September 2, 2016 23:10
SLK-581 Linkage in SQL
set sqlformat ansiconsole
--See: http://www.aihw.gov.au/WorkArea/DownloadAsset.aspx?id=60129551915
--http://meteor.aihw.gov.au/content/index.phtml/itemId/349510
with raw_data as (
select
upper('Smith') last,
upper('Nicholas') first,
to_date('29-01-1959', 'dd-mm-yyyy') dob,
'M' gender
from dual
@tschf
tschf / script.sql
Last active May 7, 2017 02:59
Oracle: case with a tuple (object)
create type ot_info is object (
a number,
b number,
c number,
map member function equals return raw
);
/
create type body ot_info as