Exporting a CLOB to a text file using Oracle SQL Developer

if you have access to the file system on your database box you could do something like this: CREATE OR REPLACE DIRECTORY documents AS ‘C:\’; SET SERVEROUTPUT ON DECLARE l_file UTL_FILE.FILE_TYPE; l_clob CLOB; l_buffer VARCHAR2(32767); l_amount BINARY_INTEGER := 32767; l_pos INTEGER := 1; BEGIN SELECT col1 INTO l_clob FROM tab1 WHERE rownum = 1; l_file … Read more

How to see refcursor result/output in Oracle SQL Developer? [duplicate]

You can use a bind variable declared in SQL Developer to hold and show the results: var r refcursor; exec myPackage.mySPTest(P_NOTIFICATION_ID => 1975357, P_CURSOR => :r); print r; exec is shorthand for an anonymous block so this is equivalent to: var r refcursor; begin myPackage.mySPTest(P_NOTIFICATION_ID => 1975357, P_CURSOR => :r); end; / print r; Unless … Read more

How to change the timezone of Oracle SQL Developer / Oracle Data Modeler?

If you need to change the time zone of Oracle SQL Developer (or Oracle Data Modeler), then this is how to do it: Go to the installation directory of Oracle SQL Developer. Open the file located at: sqldeveloper/bin/sqldeveloper.conf. At the end of file, add the following line: AddVMOption -Duser.timezone=GMT-4. You will need to change the … Read more

How to extract week number in sql

After converting your varchar2 date to a true date datatype, then convert back to varchar2 with the desired mask: to_char(to_date(’01/02/2012′,’MM/DD/YYYY’),’WW’) If you want the week number in a number datatype, you can wrap the statement in to_number(): to_number(to_char(to_date(’01/02/2012′,’MM/DD/YYYY’),’WW’)) However, you have several week number options to consider: WW Week of year (1-53) where week 1 … Read more

How do you get nicely formatted results from an Oracle procedure that returns a reference cursor?

If GetQuestions is a function returning a refcursor, which seems to be what you have in the SQL Server version, then rather you may be able to do something like this: select * from table(MyPackage.GetQuestions(‘OMG Ponies’)); Or if you need it in a PL/SQL block then you can use the same select in a cursor. … Read more

Oracle SQL Developer and PostgreSQL

Oracle SQL Developer 4.0.1.14 surely does support connections to PostgreSQL. download JDBC driver for Postgres (http://jdbc.postgresql.org/download.html) in SQL Developer go to Tools → Preferences, Database → Third Party JDBC Drivers and add the jar file (see http://www.oracle.com/technetwork/products/migration/jdbc-migration-1923524.html for step by step example) now just make a new Database Connection and instead of Oracle, select PostgreSQL … Read more

How to generate an entity-relationship (ER) diagram using Oracle SQL Developer

Create a diagram for existing database schema or its subset as follows: Click File → Data Modeler → Import → Data Dictionary. Select a DB connection (add one if none). Click Next. Check one or more schema names. Click Next. Check one or more objects to import. Click Next. Click Finish. The ERD is displayed. … Read more