Best Practices for Creating Tables
Recently our DBA recommended the following for creating tables. All constraints (primary keys, unique keys, foreign keys, etc….) should be declared outside of the CREATE TABLE …. statements, and...
View ArticleList users
To list all the users in a database log in as the sysadmin and query the dba_users table. $ sqlplus sysman/123456@dev01 SQL> select username from dba_users where username like 'Frank%'; Related...
View ArticleRuby on Rails and Oracle
Get the Ruby OCI8 driver. Download the file that ends with “mswin32.rb” and install like this: E:\ruby>ruby ruby-oci8-1.0.3-mswin32.rb Copy OCI8.rb to e:/ruby/lib/ruby/site_ruby/1.8/DBD/OCI8 Copy...
View ArticleHow to Import and Create Users in Oracle
When you do an import sometimes you will find you will need to also create a user for this new set of data. Today I find myself in that situation as I imported data from Bell Canada and set up a new...
View ArticleSQL*Plus Commit on Exit
I was always doing a commit before exiting SQL*Plus when it occurred to me today that maybe I didn’t need to do that. Doing a Google search quickly answered that for me. If you issue a graceful exit...
View ArticleHow to Alter Table
(Photo: Rain on a window in Sunnyvale by basictheory) There are various ways to alter a table and I usually forget what they are so I am writing this post to remind me. Columns ALTER TABLE foo DROP...
View ArticleSQL Insert in One Table Based on Values in Another Table
(Photo: Love’s Old Sweet Song by linda yvonne) The syntax for doing this is similar to doing an update in one table based on values in another table yet simpler. INSERT INTO suppliers (name) SELECT...
View ArticleSQL Delete in One Table Based on Values in Another Table
Growing by Simon Peckham Delete From One Table Whose Values Don’t Appear in Another Table Sometimes you will find that you have items in a table whose values reference items in another table that no...
View ArticleCreate Tablespaces in Oracle
Zero Table by CommandZed Previously I posted about how to import and create users in Oracle and in those examples I used the tablespaces provided by Oracle, users and temp. But often you will want to...
View ArticleRegular Expressions in Oracle SQL
For a project I needed to change the picture URL’s of all users. Fortunately Oracle SQL supports regular expressions making this problem much easier to solve. SQL to select pictures to change: SELECT...
View ArticleBest Practices for Creating Tables
Recently our DBA recommended the following for creating tables. All constraints (primary keys, unique keys, foreign keys, etc….) should be declared outside of the CREATE TABLE …. statements, and...
View ArticleList users
To list all the users in a database log in as the sysadmin and query the dba_users table. $ sqlplus sysman/123456@dev01 SQL> select username from dba_users where username like 'Frank%'; Related...
View ArticleRuby on Rails and Oracle
Get the Ruby OCI8 driver. Download the file that ends with “mswin32.rb” and install like this: E:\ruby>ruby ruby-oci8-1.0.3-mswin32.rb Copy OCI8.rb to e:/ruby/lib/ruby/site_ruby/1.8/DBD/OCI8 Copy...
View ArticleHow to Import and Create Users in Oracle
When you do an import sometimes you will find you will need to also create a user for this new set of data. Today I find myself in that situation as I imported data from Bell Canada and set up a new...
View ArticleSQL*Plus Commit on Exit
I was always doing a commit before exiting SQL*Plus when it occurred to me today that maybe I didn’t need to do that. Doing a Google search quickly answered that for me. If you issue a graceful exit...
View ArticleHow to Alter Table
(Photo: Rain on a window in Sunnyvale by basictheory) There are various ways to alter a table and I usually forget what they are so I am writing this post to remind me. Columns ALTER TABLE foo DROP...
View ArticleSQL Insert in One Table Based on Values in Another Table
(Photo: Love’s Old Sweet Song by linda yvonne) The syntax for doing this is similar to doing an update in one table based on values in another table yet simpler. INSERT INTO suppliers (name) SELECT...
View ArticleSQL Delete in One Table Based on Values in Another Table
Growing by Simon Peckham Delete From One Table Whose Values Don’t Appear in Another Table Sometimes you will find that you have items in a table whose values reference items in another table that no...
View ArticleCreate Tablespaces in Oracle
Zero Table by CommandZed Previously I posted about how to import and create users in Oracle and in those examples I used the tablespaces provided by Oracle, users and temp. But often you will want to...
View ArticleRegular Expressions in Oracle SQL
For a project I needed to change the picture URL’s of all users. Fortunately Oracle SQL supports regular expressions making this problem much easier to solve. SQL to select pictures to change: SELECT...
View Article
More Pages to Explore .....