Skip to content

Content Tagged "oracle"

Page 1 of 2

Content Tagged "oracle"

Build a Django Docker Image with Cx-Oracle

July 17, 2018Categories: Software, Tutorial
TL;DR: Don't use alpine images. There's a glibc issue . We added a cx-oracle dependency to one of our django apps. As the previous image was just an alpine basic (python) image we needed to put in place a process to build the new image. Initially, I've tried to use the same alpine image (oh…

Build Update Statements with Oracle SQL Developer and Python

June 18, 2018Categories: Software, Tutorial
By default, SQL Developer can only export INSERT statements. This is quite unfortunate when one needs to build UPDATE statements because their syntax is different. I've tried to use regexp to convert the statements but I didn't find it not straight forward at all. So, I cam up with the following…

Match String on Multiple Columns

October 16, 2017Category: Software
TL;DR: Use concatenation, Luke! I had to search a name for an user in a table containing the first and last names in separate columns. After a while I got tired on looking up the first_name and last_name columns one at a time and I decided to try and search both. The result is something like: I…

Display a Function's Errors in Oracle

June 30, 2017Categories: Software, Tutorial
TL;DR: Use the power of DBMS_OUTPUT.PUT_LINE , Luke! I've built a function along the lines of: When using the function, I got some 0 results and I wanted to know why. The solution I got was using DBMS_OUTPUT.PUT_LINE : Now, all you have to do is enable DBMS_OUTPUT in your environment and you…

Call an Oracle Function from Spring with CallableStatement

June 29, 2017Categories: Software, Tutorial
Following the previous post , I wondered if there's a more elegant way to call a function. It turns out there is and it's based on CallableStatement : The CallableStatementCreator sets up the statement and the CallableStatementCallback executes the statement and returns the value up to the…

Call an Oracle Function from Spring

June 29, 2017Categories: Software, Tutorial
The easiest way to call a function from Spring is using SELECT . For example, having a function HAS_PANEL_FLAG_OK with two parameters and returning an integer , the function call looks like: This will return all flags for the panels matching the condition. Java Call The query string can be…

Delete Dependent Entries of a Table in Oracle PL/SQL

March 13, 2017Categories: Software, Tutorial
The other day I had a task to clean up a database which was populated with a list of records. Unfortunately, my main table is linked to a host of other tables via foreign key dependencies and, to make things worse, no CASCADE constraints are specified. The process I want to is as follows: Scan…

List Columns in a ResultSet

December 8, 2016Categories: Software, Tutorial
In order to list all columns in a JDBC ResultSet (e.g. for debug purposes), you need to iterate through its metadata: Note: Column numbers start from 1, not 0 (hence the md.getColumnName(i + 1) above). I usually wrap this in a if(logger.isTraceEnabled()) so it doesn't get triggered all the…

Select Rows Where Value from One Column Matches Other Column

November 23, 2016Categories: Software, Tutorial
TL;DR: Use a JOIN . I've got a table representing a tree, using two columns: and I want to select all children for parents whose CLASS_ID have a certain value (e.g. abcd ). The way I could do it was via a JOIN statement: This will: Perform a join where child.parent_prop_id = parent.prop_id…

Simulate UNION with BLOBs

November 21, 2016Category: Software
TL;DR : If you have BLOB s, you need to use UNION ALL . If you use UNION ALL , you need to partition off a criterion and select the first row. The other day I had to figure out how UNION works in Oracle, because we're retrofitting an application with extra features. Assuming I have 2 tables…
Next

All tags