View cloudshell_sqlcl.sh
# | |
# Print current instances for autonomous db | |
# Uses $OCI_TENANCY for compartment id since that is the "root" | |
# | |
cat > db.jq <<EOF | |
.data[] | | |
."db-name" , | |
"\t" + .id , | |
"\t" + ."db-name" + "_low" , | |
"\n\tSDW: " + ."connection-urls"."sql-dev-web-url", |
View title_change.sql
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"'); | |
View klrice-slack.css
body{font-family: Hack,Slack-Lato,appleLogo,sans-serif;} |
View loadEmojis.sql
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)) { |
View exportDDL.sql
script | |
var CopyOption = Java.type("java.nio.file.StandardCopyOption"); | |
// put all files here >>> | |
var ddlPath = java.nio.file.FileSystems.getDefault().getPath('ddl') | |
var fs = java.nio.file.FileSystems.getDefault(); | |
var f = java.nio.file.Files; | |
if ( ! f.exists(ddlPath)) { | |
f.createDirectory(ddlPath) |
View awr_report_via_ords.sql
DECLARE | |
l_roles owa.vc_arr; | |
l_patterns owa.vc_arr; | |
l_modules owa.vc_arr; | |
BEGIN | |
l_roles(1) := 'SQL Developer'; | |
l_patterns(1):= '/dba/*'; | |
l_modules(1) := 'dba/awr'; |
View autocorrect.js
var fatFinger = [ { bad:"form", good:"from"}, | |
{ bad:"hwere", good:"where"}, | |
{ bad:"dula", good:"dual"} | |
]; | |
// SQLCL's Command Registry |
View conditional-comp-autonomous.sql
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 |
View nodeSQLCL.js
// 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"); |
View prehook-context.sql
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 |
NewerOlder