Skip to content

Content Tagged "sql"

Page 1 of 2

Content Tagged "sql"

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…

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…

Move SQL Developer Data from the Roaming Profile in Windows

October 19, 2016Category: IT
TL;DR: : Set up IDE_USER_DIR . I have to keep my roaming profile on a diet and this means moving a bunch of default directories around. The latest victim is SQL Developer According to this post , the environment variable to be changed is IDE_USER_DIR . From the post: According to documentation…

TIL you can mix ASC, DESC in ORDER BY (SQLite)

November 4, 2015Category: Software
TL;DR: You can use ORDER BY column1 DESC, column2 ASC ... in your code. The other day I was trying to get a custom ordering in a list for an object: order decreasing by UNREAD MESSAGES count and then order ascending by DATE Initially, I tried a GROUP BY, but I could not get it to do the ordering…

Add Primary Key Column to PostgreSQL Table

March 23, 2015Category: Software
The other day I got a question: How to add a numeric PK column to an already existent table? A quick look on the net showed that it is indeed possible to add an auto-incrementing PK to an already existing table ( if you don't have already a PK that is! ). The code is quite simple too! The statement…

Postgres: Show Schema Sizes in a Database

October 2, 2014Category: Software
While loading a large database from files to a Postgres schema, I found very useful to know how much space on disk it actually occupies (just in case I need to re-size the disk). I found this answer online: Which results in a list like: ] HTH, PS: All credit goes to this StackOverflow answer !

PostgreSQL: Call a Stored Procedure for Every Row

May 13, 2014Category: Software
I guess that newbies in PostgreSQL like me have first question when they create a store procedure: How do I call it? The answer is simple; you just execute Then, usually immediately the second question pops up: I wrote a procedure which I need to call for each row in a table. How do I do that? The…

UPSERT (update or insert) in Oracle with Python

March 24, 2014Category: Software
One of the things I had to do is to build a script to upload data (e.g. the content of a list of files) into a database with a single table. My table has 3 columns: ID - a 20-character string identifier with PK properties (unique) ARTICLE - an XMLType element with the article details CITEDBY - an…

Memory dump: Work with XMLField in Oracle (part 4)

March 7, 2014Category: Software
Table of Contents Part 1 - Prerequisites Part 2 - Create a table and perform a SELECT Part 3 - User Python to insert data Part 4 - references References for the series Using XQuery with Oracle XML DB XMLTYPE Oracle XML DB Developer's Guide ORA-01461: can bind a LONG value only for insert into a LONG…

Memory dump: Work with XMLField in Oracle (part 2)

March 5, 2014Category: Software
TL;DR: Here I present a SQL example from creating the table to performing a SELECT . Table of Contents Part 1 - Prerequisites Part 2 - Create a table and perform a SELECT Part 3 - User Python to insert data Part 4 - references Table and XMLTYPE Once we've seen that we have XMLTYPE available…
Next

All tags