This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REM Add to ORDS config | |
REM <entry key="procedure.rest.preHook">klrice.my_ords_ctx.populate</entry> | |
REM Create a context | |
CREATE OR REPLACE CONTEXT ords_params USING my_ords_ctx; | |
REM PKG to populate the context | |
CREATE OR REPLACE PACKAGE my_ords_ctx AS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// npm install java | |
var java = require("java"); | |
java.classpath.push("ojdbc8.jar"); | |
java.classpath.push("oracle.dbtools-common.jar"); | |
java.classpath.push("oracle.dbtools.http.jar"); | |
java.classpath.push("oracle.dbtools.jdbcrest.jar"); | |
java.classpath.push("oracle.sqldeveloper.sqlcl.jar"); | |
java.classpath.push("xmlparserv2.jar"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set serveroutput on | |
CREATE OR REPLACE PROCEDURE is_adb AS | |
BEGIN | |
$IF $$is_autonomous $THEN | |
dbms_output.put_line('Yup'); | |
$ELSE | |
dbms_output.put_line('No'); | |
$END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fatFinger = [ { bad:"form", good:"from"}, | |
{ bad:"hwere", good:"where"}, | |
{ bad:"dula", good:"dual"} | |
]; | |
// SQLCL's Command Registry |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
drop table emoji; | |
create table emoji ( keyword varchar2(30), emoji varchar2(200)); | |
script | |
// read text content from the given URL | |
function readText(url) { | |
// Using JavaImporter to resolve classes | |
// from specified java packages within the | |
// 'with' statement below | |
with (new JavaImporter(java.io, java.net)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body{font-family: Hack,Slack-Lato,appleLogo,sans-serif;} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
script | |
var dbUser = util.executeReturnOneCol('select user from dual'); | |
var globalName = util.executeReturnOneCol('select global_name from global_name'); | |
var title = "sqlcl " +dbUser + "@" + globalName | |
sqlcl.setStmt('!echo -ne "\033]0;'+title+'\007"'); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/hack-font@3/build/web/hack-subset.css"> | |
<script> | |
var refreshInteval; | |
function poolListing(){ | |
// populate the list of pools | |
fetch('http://localhost:8080/ords/_/instance-api/stable/database-pools-cache/', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Print current instances for autonomous db | |
# Uses $OCI_TENANCY for compartment id since that is the "root" | |
# | |
cat > db.jq <<EOF | |
.data[] | | |
."db-name" + "\tocid:" + .id , | |
"\t" + ."db-name" + "_low" , | |
"\tORDS Version: " + ."apex-details"."ords-version", | |
"\tAPEX Version: " + ."apex-details"."apex-version", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
script | |
// issue the sql | |
var binds = {} | |
var ret = util.executeReturnList('select help_text,page_name from APEX_APPLICATION_PAGES where rownum=1 and help_text is not null',binds); | |
// loop the results | |
for (i = 0; i < ret.length; i++) { | |
// debug is nice | |
ctx.write( ret[i].PATH+ "\n"); | |
// get the CLOB stream |