<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>betweenGo &#187; Database</title>
	<atom:link href="http://betweengo.com/category/database/feed/" rel="self" type="application/rss+xml" />
	<link>http://betweengo.com</link>
	<description>We make Ruby on Rails easy.  We make ATG easy.</description>
	<lastBuildDate>Thu, 24 Jun 2010 19:42:09 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>SQL Insert in One Table Based on Values in Another Table</title>
		<link>http://betweengo.com/2010/01/18/sql-insert-in-one-table-based-on-values-in-another-table/</link>
		<comments>http://betweengo.com/2010/01/18/sql-insert-in-one-table-based-on-values-in-another-table/#comments</comments>
		<pubDate>Mon, 18 Jan 2010 18:00:00 +0000</pubDate>
		<dc:creator>Frank Kim</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://betweengo.com/2010/01/18/sql-insert-in-one-table-based-on-values-in-another-table/</guid>
		<description><![CDATA[ 
(Photo: Love&#8217;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 customers.name
  FROM customers
  WHERE customers.id = suppliers.id);
If you want to add constant values into the insert you can do something [...]


Related posts:<ol><li><a href='http://betweengo.com/2008/07/02/sql-update-in-one-table-based-on-values-in-another/' rel='bookmark' title='Permanent Link: SQL Update in One Table Based on Values in Another Table'>SQL Update in One Table Based on Values in Another Table</a></li>
<li><a href='http://betweengo.com/2009/10/06/how-to-alter-table/' rel='bookmark' title='Permanent Link: How to Alter Table'>How to Alter Table</a></li>
<li><a href='http://betweengo.com/2007/05/29/test/' rel='bookmark' title='Permanent Link: Inserting a text value with special characters'>Inserting a text value with special characters</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p align="center"><a href="http://www.flickr.com/photos/from_linda_yvonne/2449770721/"><img style="display: inline; margin-left: 0px; margin-right: 0px" title="Love&#39;s Old Sweet Song on Flickr" alt="Love&#39;s Old Sweet Song on Flickr" src="http://farm3.static.flickr.com/2364/2449770721_71ac512444.jpg" /></a> </p>
<p align="center">(Photo: <a title="Love&#39;s Old Sweet Song on Flickr" href="http://www.flickr.com/photos/from_linda_yvonne/2449770721/">Love&#8217;s Old Sweet Song</a> by <a title="Flickr: linda yvonne&#39;s Photostream" href="http://www.flickr.com/photos/from_linda_yvonne/">linda yvonne</a>)</p>
<p>The syntax for doing this is similar to doing an <a title="SQL update in one table based on values in another - betweenGo" href="http://betweengo.com/2008/07/02/sql-update-in-one-table-based-on-values-in-another/">update in one table based on values in another table</a> yet simpler.</p>
<pre>INSERT INTO suppliers (name)
SELECT customers.name
  FROM customers
  WHERE customers.id = suppliers.id);</pre>
<p>If you want to add constant values into the insert you can do something like this.</p>
<pre>INSERT INTO suppliers (name, city)
SELECT customers.name, 'Toronto'
  FROM customers
  WHERE customers.id = suppliers.id);</pre>
<p>For further reading please see <a title="SQL INSERT INTO" href="http://www.1keydata.com/sql/sqlinsert.html">SQL INSERT INTO</a>.</p>


<p>Related posts:<ol><li><a href='http://betweengo.com/2008/07/02/sql-update-in-one-table-based-on-values-in-another/' rel='bookmark' title='Permanent Link: SQL Update in One Table Based on Values in Another Table'>SQL Update in One Table Based on Values in Another Table</a></li>
<li><a href='http://betweengo.com/2009/10/06/how-to-alter-table/' rel='bookmark' title='Permanent Link: How to Alter Table'>How to Alter Table</a></li>
<li><a href='http://betweengo.com/2007/05/29/test/' rel='bookmark' title='Permanent Link: Inserting a text value with special characters'>Inserting a text value with special characters</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://betweengo.com/2010/01/18/sql-insert-in-one-table-based-on-values-in-another-table/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Alter Table</title>
		<link>http://betweengo.com/2009/10/06/how-to-alter-table/</link>
		<comments>http://betweengo.com/2009/10/06/how-to-alter-table/#comments</comments>
		<pubDate>Tue, 06 Oct 2009 17:53:19 +0000</pubDate>
		<dc:creator>Frank Kim</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://betweengo.com/?p=901</guid>
		<description><![CDATA[
(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 COLUMN nickname;
ALTER TABLE foo RENAME COLUMN name TO nickname;
ALTER TABLE foo ADD name VARCHAR2(254) DEFAULT 'Frank' NOT NULL;
ALTER [...]


Related posts:<ol><li><a href='http://betweengo.com/2006/08/17/altering-a-column-in-a-table/' rel='bookmark' title='Permanent Link: HOWTO Alter a Column in a Table'>HOWTO Alter a Column in a Table</a></li>
<li><a href='http://betweengo.com/2008/08/01/best-practices-creating-tables/' rel='bookmark' title='Permanent Link: Best Practices for Creating Tables'>Best Practices for Creating Tables</a></li>
<li><a href='http://betweengo.com/2010/01/21/specifying-one-to-many-relationship-in-atg-repositories/' rel='bookmark' title='Permanent Link: Specifying One-to-Many Relationship in ATG Repositories'>Specifying One-to-Many Relationship in ATG Repositories</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p style="text-align: center"><a href="http://www.flickr.com/photos/basictheory/296819473/"><img title="Rain on a window in Sunnyvale on Flickr" src="http://farm1.static.flickr.com/105/296819473_d0bb6d8c2c.jpg" alt="Rain on a window in Sunnyvale" /></a></p>
<p style="text-align: center">(Photo: <a title="IMG_1021.JPG on Flickr" href="http://www.flickr.com/photos/basictheory/296819473/">Rain on a window in Sunnyvale</a> by <a title="Flickr: basictheory's Photostream" href="http://www.flickr.com/photos/basictheory/">basictheory</a>)</p>
<p>There are various ways to alter a table and I usually forget what they are so I am writing this post to remind me. <img src='http://betweengo.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><strong>Columns</strong></p>
<pre>ALTER TABLE foo DROP COLUMN nickname;
ALTER TABLE foo RENAME COLUMN name TO nickname;
ALTER TABLE foo ADD name VARCHAR2(254) DEFAULT 'Frank' NOT NULL;
ALTER TABLE foo ADD age INTEGER DEFAULT 0 NOT NULL;
ALTER TABLE foo MODIFY name VARCHAR2(500);</pre>
<p><strong>Constraints</strong></p>
<pre>ALTER TABLE foo DROP CONSTRAINT foo_a_f;
ALTER TABLE foo ADD CONSTRAINT foo_b_f FOREIGN KEY (bar_id) REFERENCES bar (id);</pre>
<p>If you forget the name of a constraint and you can try to find it using this handy piece of SQL.</p>
<pre>SELECT constraint_name FROM user_constraints WHERE constraint_name LIKE 'foo_%_f%';</pre>


<p>Related posts:<ol><li><a href='http://betweengo.com/2006/08/17/altering-a-column-in-a-table/' rel='bookmark' title='Permanent Link: HOWTO Alter a Column in a Table'>HOWTO Alter a Column in a Table</a></li>
<li><a href='http://betweengo.com/2008/08/01/best-practices-creating-tables/' rel='bookmark' title='Permanent Link: Best Practices for Creating Tables'>Best Practices for Creating Tables</a></li>
<li><a href='http://betweengo.com/2010/01/21/specifying-one-to-many-relationship-in-atg-repositories/' rel='bookmark' title='Permanent Link: Specifying One-to-Many Relationship in ATG Repositories'>Specifying One-to-Many Relationship in ATG Repositories</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://betweengo.com/2009/10/06/how-to-alter-table/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL*Plus Commit on Exit</title>
		<link>http://betweengo.com/2009/08/25/sqlplus-commit-on-exit/</link>
		<comments>http://betweengo.com/2009/08/25/sqlplus-commit-on-exit/#comments</comments>
		<pubDate>Tue, 25 Aug 2009 16:24:50 +0000</pubDate>
		<dc:creator>Frank Kim</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[sqlplus]]></category>

		<guid isPermaLink="false">http://betweengo.com/2009/08/25/sqlplus-commit-on-exit/</guid>
		<description><![CDATA[ 
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.&#160; Doing a Google search quickly answered that for me.
If you issue a graceful exit (via the “exit” or “quit” command), sqlplus will always issue a commit. However, if you were to [...]


Related posts:<ol><li><a href='http://betweengo.com/2006/04/04/howto-log-sql-on-jboss/' rel='bookmark' title='Permanent Link: How to Log SQL on JBoss'>How to Log SQL on JBoss</a></li>
<li><a href='http://betweengo.com/2006/12/06/how-to-retrieve-oracle-version-information/' rel='bookmark' title='Permanent Link: How to Retrieve Oracle Version Information'>How to Retrieve Oracle Version Information</a></li>
<li><a href='http://betweengo.com/2008/07/02/sql-update-in-one-table-based-on-values-in-another/' rel='bookmark' title='Permanent Link: SQL Update in One Table Based on Values in Another Table'>SQL Update in One Table Based on Values in Another Table</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p style="text-align: center"><a href="http://www.flickr.com/photos/cpstorm/140115572/"><img title="EXIT on Flickr" alt="EXIT on Flickr" src="http://farm1.static.flickr.com/47/140115572_d1eff7c94a.jpg" /></a> </p>
<p>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.&#160; Doing a <a title="commit exit - Google Search" href="http://www.google.com/search?q=commit+exit">Google search</a> quickly answered that for me.</p>
<blockquote><p>If you issue a graceful exit (via the “exit” or “quit” command), sqlplus will always issue a commit. However, if you were to be ungracefully disconnected, for example by closing your terminal window, then PMON will issue a rollback like it does with any other disconnected session.</p>
<p><a title="sqlplus commit-on-exit? «  die Seilerwerks" href="http://seilerwerks.wordpress.com/2007/01/09/sqlplus-commit-on-exit/">sqlplus commit-on-exit?</a></p>
</blockquote>
<p><strong>Therefore there is no need to do a commit before you exit. </strong></p>
<p>You can also set autocommit on, it is off by default, but I would not recommend doing this.</p>
<blockquote><p>During interactive usage with sqlplus, Oracle also supports an AUTOCOMMIT option. With this option set to ON each individual SQL statement is treated as a transaction an will be automatically commited right after it is executed. A user can change the AUTOCOMMIT option by typing </p>
<pre> SET AUTOCOMMIT ON</pre>
<p>or </p>
<pre> SET AUTOCOMMIT OFF</pre>
<p>whereas by typing </p>
<pre> SHOW ALL</pre>
<p>a user can see the current setting for the option (including other ones).</p>
<p><a title="Oracle SQL Transactions" href="http://infolab.stanford.edu/~ullman/fcdb/oracle/or-nonstandard.html#transactions">Oracle SQL Transactions</a></p>
</blockquote>


<p>Related posts:<ol><li><a href='http://betweengo.com/2006/04/04/howto-log-sql-on-jboss/' rel='bookmark' title='Permanent Link: How to Log SQL on JBoss'>How to Log SQL on JBoss</a></li>
<li><a href='http://betweengo.com/2006/12/06/how-to-retrieve-oracle-version-information/' rel='bookmark' title='Permanent Link: How to Retrieve Oracle Version Information'>How to Retrieve Oracle Version Information</a></li>
<li><a href='http://betweengo.com/2008/07/02/sql-update-in-one-table-based-on-values-in-another/' rel='bookmark' title='Permanent Link: SQL Update in One Table Based on Values in Another Table'>SQL Update in One Table Based on Values in Another Table</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://betweengo.com/2009/08/25/sqlplus-commit-on-exit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Import and Create Users in Oracle</title>
		<link>http://betweengo.com/2009/07/17/how-to-import-and-create-users-in-oracle/</link>
		<comments>http://betweengo.com/2009/07/17/how-to-import-and-create-users-in-oracle/#comments</comments>
		<pubDate>Fri, 17 Jul 2009 17:09:00 +0000</pubDate>
		<dc:creator>Frank Kim</dc:creator>
				<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://betweengo.com/2009/07/17/how-to-import-and-create-users-in-oracle/</guid>
		<description><![CDATA[ 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 user for that data.

Create a new user for the data.
This example creates [...]


Related posts:<ol><li><a href='http://betweengo.com/2006/02/22/import-project-into-eclipse/' rel='bookmark' title='Permanent Link: Import A Project Into Eclipse'>Import A Project Into Eclipse</a></li>
<li><a href='http://betweengo.com/2008/04/16/setting-up-cygwin-users-and-groups/' rel='bookmark' title='Permanent Link: Setting up cygwin users and groups'>Setting up cygwin users and groups</a></li>
<li><a href='http://betweengo.com/2008/08/08/list-users/' rel='bookmark' title='Permanent Link: List users'>List users</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><a href="http://java.sun.com/j2ee/compatibility_1.4.html"><img class="alignright" title="Oracle" alt="Oracle" src="http://java.sun.com/j2ee/images/oracle_logo.gif" /></a> 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 user for that data.</p>
<ol>
<li><strong>Create a new user for the data.</strong>
<p>This example creates a user named &quot;foo&quot; with the password &quot;foo&quot;.&#160; Foo is a typical user that can create sessions, synonyms, procedures and tables.</p>
<pre>CREATE USER FOO IDENTIFIED BY FOO
  DEFAULT TABLESPACE users
  TEMPORARY TABLESPACE temp
  QUOTA UNLIMITED ON users;

GRANT CREATE SESSION to FOO;
GRANT CREATE SYNONYM TO FOO;
GRANT CREATE PROCEDURE TO FOO;
GRANT CREATE TABLE TO FOO;
GRANT CREATE VIEW TO FOO;</pre>
<p>For more information please read <a title="Oracle&#39;s CREATE USER documentation" href="http://www.mcs.csueastbay.edu/support/oracle/doc/10.2/server.102/b14200/statements_8003.htm">Oracle&#8217;s CREATE USER documentation</a>.</p>
<p>If you want this user to be a DBA you can grant that to her too</p>
<pre>GRANT DBA TO FOO;</pre>
</li>
<li><strong>Import the dump using the new user.</strong>
<p>This example imports the dump from the file &quot;dump.dmp&quot;. This dump was created using the user &quot;foo&quot; and is being imported to the user &quot;foo&quot;. The dump will be logged in the file &quot;dump.log&quot;. </p>
<pre>imp system/system@example file=dump.dmp log=dump.log fromuser=foo touser=foo</pre>
<p>For more information please read <a title="Oracle&#39;s Import Export FAQ" href="http://www.orafaq.com/wiki/Import_Export_FAQ">Oracle&#8217;s Import Export FAQ</a>.</p>
</li>
<li><strong>To redo recreate user and then import again.</strong>
<p>If you need to redo an import the easiest thing to do is to drop the user, recreate her and then do the import again. When you drop the user specify <tt>CASCADE</tt> to drop all the objects in the user&#8217;s schema.</p>
<pre>DROP USER FOO CASCADE;</pre>
<p>For more information please read <a title="Oracle&#39;s DROP USER documentation" href="http://stanford.edu/dept/itss/docs/oracle/10g/server.101/b10759/statements_9008.htm">Oracle&#8217;s DROP USER documentation</a>.</p>
</li>
</ol>


<p>Related posts:<ol><li><a href='http://betweengo.com/2006/02/22/import-project-into-eclipse/' rel='bookmark' title='Permanent Link: Import A Project Into Eclipse'>Import A Project Into Eclipse</a></li>
<li><a href='http://betweengo.com/2008/04/16/setting-up-cygwin-users-and-groups/' rel='bookmark' title='Permanent Link: Setting up cygwin users and groups'>Setting up cygwin users and groups</a></li>
<li><a href='http://betweengo.com/2008/08/08/list-users/' rel='bookmark' title='Permanent Link: List users'>List users</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://betweengo.com/2009/07/17/how-to-import-and-create-users-in-oracle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby on Rails and Oracle</title>
		<link>http://betweengo.com/2008/10/08/ruby-on-rails-and-oracle/</link>
		<comments>http://betweengo.com/2008/10/08/ruby-on-rails-and-oracle/#comments</comments>
		<pubDate>Wed, 08 Oct 2008 23:04:18 +0000</pubDate>
		<dc:creator>Frank Kim</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://betweengo.com/?p=331</guid>
		<description><![CDATA[
Get the Ruby OCI8 driver.  Download the file that ends with &#8220;mswin32.rb&#8221; and install like this:
E:\ruby&#62;ruby ruby-oci8-1.0.3-mswin32.rb
Copy OCI8.rb to e:/ruby/lib/ruby/site_ruby/1.8/DBD/OCI8
Copy oci8.rb to e:/ruby/lib/ruby/site_ruby/1.8
Copy oci8lib.so to e:/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt
OK?
Enter Yes/No: Yes
Copying OCI8.rb to e:/ruby/lib/ruby/site_ruby/1.8/DBD/OCI8 ... done
Copying oci8.rb to e:/ruby/lib/ruby/site_ruby/1.8 ... done
Copying oci8lib.so to e:/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt ... done
OK
You can test the driver by running a query using Ruby.
E:\&#62;ruby -r oci8 [...]


Related posts:<ol><li><a href='http://betweengo.com/2005/11/08/setting-up-a-windows-ruby-on-rails-environment/' rel='bookmark' title='Permanent Link: Setting up a Windows Ruby on Rails Environment'>Setting up a Windows Ruby on Rails Environment</a></li>
<li><a href='http://betweengo.com/2006/01/10/possible-reason-for-ruby-on-rails-tests-failing/' rel='bookmark' title='Permanent Link: Possible reason for Ruby on Rails tests failing'>Possible reason for Ruby on Rails tests failing</a></li>
<li><a href='http://betweengo.com/2005/10/16/what-is-ruby-on-rails/' rel='bookmark' title='Permanent Link: What Is Ruby on Rails'>What Is Ruby on Rails</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<ol>
<li>Get the <a title="ruby-oci8" href="http://rubyforge.org/projects/ruby-oci8/">Ruby OCI8 driver</a>.  Download the file that ends with &#8220;mswin32.rb&#8221; and install like this:
<pre>E:\ruby&gt;ruby ruby-oci8-1.0.3-mswin32.rb
Copy OCI8.rb to e:/ruby/lib/ruby/site_ruby/1.8/DBD/OCI8
Copy oci8.rb to e:/ruby/lib/ruby/site_ruby/1.8
Copy oci8lib.so to e:/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt
OK?
Enter Yes/No: Yes
Copying OCI8.rb to e:/ruby/lib/ruby/site_ruby/1.8/DBD/OCI8 ... done
Copying oci8.rb to e:/ruby/lib/ruby/site_ruby/1.8 ... done
Copying oci8lib.so to e:/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt ... done
OK</pre>
<p>You can test the driver by running a query using Ruby.</p>
<pre>E:\&gt;ruby -r oci8 -e "OCI8.new('foo','12345','sid').exec(
'SELECT * from users') do |r| puts r.join(' | ') ; end"</pre>
</li>
<li>Install the ActiveRecord Oracle adapter.gem
<pre>E:\ruby&gt;install activerecord-oracle-adapter --source http://gems.rubyonrails.org</pre>
</li>
<li>Update config/database.yml to connect to Oracle
<pre>development:
  adapter: oracle
  database: sid
  username: foo
  password: 12345
  timeout: 5000</pre>
</li>
<li>Test by doing a rake db:migrate.</li>
<li>Test by running the Ruby on Rails server and making sure there are no errors upon startup.</li>
</ol>
<p>This article is based on these articles.</p>
<ul>
<li><a title="Oracle in Ruby on Rails" href="http://wiki.rubyonrails.com/rails/pages/Oracle">Oracle in Ruby on Rails</a></li>
<li><a title="Ruby on Rails with Oracle FAQ" href="http://www.oracle.com/technology/pub/articles/saternos-ror-faq.html">Ruby on Rails with Oracle FAQ</a></li>
<li><a title="Connecting Ruby on Rails to Oracle on an Intel Mac in Leopard (Mac OSX 10.5)" href="http://www.foliosus.com/2007/11/19/connecting-ruby-on-rails-to-oracle-on-an-intel-mac-in-leopard-mac-osx-105/">Connecting Ruby on Rails to Oracle on an Intel Mac in Leopard (Mac OSX 10.5)</a></li>
</ul>


<p>Related posts:<ol><li><a href='http://betweengo.com/2005/11/08/setting-up-a-windows-ruby-on-rails-environment/' rel='bookmark' title='Permanent Link: Setting up a Windows Ruby on Rails Environment'>Setting up a Windows Ruby on Rails Environment</a></li>
<li><a href='http://betweengo.com/2006/01/10/possible-reason-for-ruby-on-rails-tests-failing/' rel='bookmark' title='Permanent Link: Possible reason for Ruby on Rails tests failing'>Possible reason for Ruby on Rails tests failing</a></li>
<li><a href='http://betweengo.com/2005/10/16/what-is-ruby-on-rails/' rel='bookmark' title='Permanent Link: What Is Ruby on Rails'>What Is Ruby on Rails</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://betweengo.com/2008/10/08/ruby-on-rails-and-oracle/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>List users</title>
		<link>http://betweengo.com/2008/08/08/list-users/</link>
		<comments>http://betweengo.com/2008/08/08/list-users/#comments</comments>
		<pubDate>Fri, 08 Aug 2008 19:31:19 +0000</pubDate>
		<dc:creator>Frank Kim</dc:creator>
				<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://betweengo.com/?p=265</guid>
		<description><![CDATA[To list all the users in a database log in as the sysadmin and query the dba_users table.
$ sqlplus sysman/123456@dev01

SQL&#62; select username from dba_users where username like 'Frank%';


Related posts:Determining Permissions for a User
ORA-12514 and ORA-27101
Retrieving the Source from the Database



Related posts:<ol><li><a href='http://betweengo.com/2007/07/23/determining-user-permissions/' rel='bookmark' title='Permanent Link: Determining Permissions for a User'>Determining Permissions for a User</a></li>
<li><a href='http://betweengo.com/2008/07/03/ora-12514-ora-27101/' rel='bookmark' title='Permanent Link: ORA-12514 and ORA-27101'>ORA-12514 and ORA-27101</a></li>
<li><a href='http://betweengo.com/2007/12/07/retrieving-the-source-from-the-database/' rel='bookmark' title='Permanent Link: Retrieving the Source from the Database'>Retrieving the Source from the Database</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>To list all the users in a database log in as the sysadmin and query the dba_users table.</p>
<pre>$ sqlplus sysman/123456@dev01

SQL&gt; select username from dba_users where username like 'Frank%';</pre>


<p>Related posts:<ol><li><a href='http://betweengo.com/2007/07/23/determining-user-permissions/' rel='bookmark' title='Permanent Link: Determining Permissions for a User'>Determining Permissions for a User</a></li>
<li><a href='http://betweengo.com/2008/07/03/ora-12514-ora-27101/' rel='bookmark' title='Permanent Link: ORA-12514 and ORA-27101'>ORA-12514 and ORA-27101</a></li>
<li><a href='http://betweengo.com/2007/12/07/retrieving-the-source-from-the-database/' rel='bookmark' title='Permanent Link: Retrieving the Source from the Database'>Retrieving the Source from the Database</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://betweengo.com/2008/08/08/list-users/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Best Practices for Creating Tables</title>
		<link>http://betweengo.com/2008/08/01/best-practices-creating-tables/</link>
		<comments>http://betweengo.com/2008/08/01/best-practices-creating-tables/#comments</comments>
		<pubDate>Fri, 01 Aug 2008 15:02:04 +0000</pubDate>
		<dc:creator>Frank Kim</dc:creator>
				<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://betweengo.com/?p=258</guid>
		<description><![CDATA[Recently our DBA recommended the following for creating tables.

All constraints (primary keys, unique keys, foreign keys, etc&#8230;.) should be declared outside of the CREATE TABLE &#8230;. statements, and instead done as ALTER TABLE statements.
All tables must have table and column comments to provide information for the data dictionary/schema metadata.

Not Best Practice:
CREATE TABLE items (
  [...]


Related posts:<ol><li><a href='http://betweengo.com/2008/08/01/repository-creating-tables-automatically/' rel='bookmark' title='Permanent Link: Repository creating tables automatically'>Repository creating tables automatically</a></li>
<li><a href='http://betweengo.com/2006/08/17/altering-a-column-in-a-table/' rel='bookmark' title='Permanent Link: HOWTO Alter a Column in a Table'>HOWTO Alter a Column in a Table</a></li>
<li><a href='http://betweengo.com/2009/10/06/how-to-alter-table/' rel='bookmark' title='Permanent Link: How to Alter Table'>How to Alter Table</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Recently our DBA recommended the following for creating tables.</p>
<ol>
<li>All constraints (primary keys, unique keys, foreign keys, etc&#8230;.) should be declared outside of the CREATE TABLE &#8230;. statements, and instead done as ALTER TABLE statements.</li>
<li>All tables must have table and column comments to provide information for the data dictionary/schema metadata.</li>
</ol>
<p><strong>Not Best Practice:</strong></p>
<pre>CREATE TABLE items (
  id   VARCHAR2(40) NOT NULL,
  type NUMBER(5)    NOT NULL,
  PRIMARY KEY (id)
);</pre>
<p><strong>Best Practice:</strong></p>
<pre>CREATE TABLE items (
  id   VARCHAR2(40) NOT NULL,
  type NUMBER(5)    NOT NULL
);
ALTER TABLE items ADD CONSTRAINT items_pk PRIMARY KEY (id);
COMMENT ON TABLE items IS 'repository items';
COMMENT ON COLUMN items.id IS 'primary key (repository id)';
COMMENT ON COLUMN items.type IS 'item type';</pre>
<p>I asked the DBA why this is considered best practice and this is what he said.</p>
<blockquote><p>The DBA’s put indexes into a different tablespace than the table itself for storage, admin, and somewhat performance reasons (NetApp spreads out the I/O so does not quite apply to Upromise environment).</p>
<p>If the PK is part of the table create statement, they have to break out the statement in order to put the PK into a different tablespace or different storage parameters than the table. Having the statements separate from the start makes things smoother.</p>
<p>- Jeff Janousek, Upromise DBA</p></blockquote>


<p>Related posts:<ol><li><a href='http://betweengo.com/2008/08/01/repository-creating-tables-automatically/' rel='bookmark' title='Permanent Link: Repository creating tables automatically'>Repository creating tables automatically</a></li>
<li><a href='http://betweengo.com/2006/08/17/altering-a-column-in-a-table/' rel='bookmark' title='Permanent Link: HOWTO Alter a Column in a Table'>HOWTO Alter a Column in a Table</a></li>
<li><a href='http://betweengo.com/2009/10/06/how-to-alter-table/' rel='bookmark' title='Permanent Link: How to Alter Table'>How to Alter Table</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://betweengo.com/2008/08/01/best-practices-creating-tables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ORA-12514 and ORA-27101</title>
		<link>http://betweengo.com/2008/07/03/ora-12514-ora-27101/</link>
		<comments>http://betweengo.com/2008/07/03/ora-12514-ora-27101/#comments</comments>
		<pubDate>Thu, 03 Jul 2008 13:57:45 +0000</pubDate>
		<dc:creator>Frank Kim</dc:creator>
				<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://betweengo.com/?p=205</guid>
		<description><![CDATA[This morning I was unable to access my Oracle database which runs on my laptop.  It&#8217;s the first time I have had this problem.
When I tried to login I saw this.
$ sqlplus foo/foo@dev01

SQL*Plus: Release 10.2.0.1.0 - Production on Thu Jul 3 06:38:20 2008

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

ERROR:
ORA-12514: TNS:listener does not [...]


Related posts:<ol><li><a href='http://betweengo.com/2008/04/18/oracle-tns-listener-service-not-starting/' rel='bookmark' title='Permanent Link: Oracle TNS Listener service not starting'>Oracle TNS Listener service not starting</a></li>
<li><a href='http://betweengo.com/2005/09/29/updating-dates/' rel='bookmark' title='Permanent Link: Updating/Reading Dates'>Updating/Reading Dates</a></li>
<li><a href='http://betweengo.com/2007/01/26/93/' rel='bookmark' title='Permanent Link: Catching Oracle exceptions'>Catching Oracle exceptions</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>This morning I was unable to access my Oracle database which runs on my laptop.  It&#8217;s the first time I have had this problem.</p>
<p>When I tried to login I saw this.</p>
<pre>$ sqlplus foo/foo@dev01

SQL*Plus: Release 10.2.0.1.0 - Production on Thu Jul 3 06:38:20 2008

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor</pre>
<p>When I tried to login without the TNS alias I saw this:</p>
<pre>$ sqlplus foo/foo

SQL*Plus: Release 10.2.0.1.0 - Production on Thu Jul 3 06:38:20 2008

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

ERROR:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist</pre>
<p>On the internet I saw recommendations to set your ORACLE_SID and ORACLE_HOME environment variables.  But on my system ORACLE_SID is not set and ORACLE_HOME is blank.  Finally I just tried restarting the OracleServiceDEV01 service and that worked.</p>


<p>Related posts:<ol><li><a href='http://betweengo.com/2008/04/18/oracle-tns-listener-service-not-starting/' rel='bookmark' title='Permanent Link: Oracle TNS Listener service not starting'>Oracle TNS Listener service not starting</a></li>
<li><a href='http://betweengo.com/2005/09/29/updating-dates/' rel='bookmark' title='Permanent Link: Updating/Reading Dates'>Updating/Reading Dates</a></li>
<li><a href='http://betweengo.com/2007/01/26/93/' rel='bookmark' title='Permanent Link: Catching Oracle exceptions'>Catching Oracle exceptions</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://betweengo.com/2008/07/03/ora-12514-ora-27101/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL Update in One Table Based on Values in Another Table</title>
		<link>http://betweengo.com/2008/07/02/sql-update-in-one-table-based-on-values-in-another/</link>
		<comments>http://betweengo.com/2008/07/02/sql-update-in-one-table-based-on-values-in-another/#comments</comments>
		<pubDate>Thu, 03 Jul 2008 01:32:27 +0000</pubDate>
		<dc:creator>Frank Kim</dc:creator>
				<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://betweengo.com/?p=204</guid>
		<description><![CDATA[ 
(Photo: Dolphin Crest by jurvetson)
I was wondering how to do this and thankfully someone wrote up a nice article on the SQL update statement.
Here is their example of how to do this.
UPDATE suppliers
SET name =
  ( SELECT customers.name
  FROM customers
  WHERE customers.id = suppliers.id)
WHERE EXISTS
  ( SELECT customers.name
  FROM [...]


Related posts:<ol><li><a href='http://betweengo.com/2010/01/18/sql-insert-in-one-table-based-on-values-in-another-table/' rel='bookmark' title='Permanent Link: SQL Insert in One Table Based on Values in Another Table'>SQL Insert in One Table Based on Values in Another Table</a></li>
<li><a href='http://betweengo.com/2007/07/23/determining-user-permissions/' rel='bookmark' title='Permanent Link: Determining Permissions for a User'>Determining Permissions for a User</a></li>
<li><a href='http://betweengo.com/2009/08/25/sqlplus-commit-on-exit/' rel='bookmark' title='Permanent Link: SQL*Plus Commit on Exit'>SQL*Plus Commit on Exit</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p align="center"><a href="http://www.flickr.com/photos/jurvetson/336157/"><img style="display: inline; margin-left: 0px; margin-right: 0px" title="Dolphin Crest on Flickr" alt="Dolphin Crest on Flickr" src="http://farm1.static.flickr.com/1/336157_df11b509aa.jpg" /></a> </p>
<p align="center">(Photo: <a title="Dolphin Crest on Flickr" href="http://www.flickr.com/photos/jurvetson/336157/">Dolphin Crest</a> by <a title="Flickr: jurvetson&#39;s Photostream" href="http://www.flickr.com/photos/jurvetson/">jurvetson</a>)</p>
<p>I was wondering how to do this and thankfully someone wrote up a nice <a title="SQL: UPDATE Statement" href="http://www.techonthenet.com/sql/update.php">article on the SQL update statement</a>.</p>
<p>Here is their example of how to do this.</p>
<pre>UPDATE suppliers
SET name =
  ( SELECT customers.name
  FROM customers
  WHERE customers.id = suppliers.id)
WHERE EXISTS
  ( SELECT customers.name
  FROM customers
  WHERE customers.id = suppliers.id);</pre>


<p>Related posts:<ol><li><a href='http://betweengo.com/2010/01/18/sql-insert-in-one-table-based-on-values-in-another-table/' rel='bookmark' title='Permanent Link: SQL Insert in One Table Based on Values in Another Table'>SQL Insert in One Table Based on Values in Another Table</a></li>
<li><a href='http://betweengo.com/2007/07/23/determining-user-permissions/' rel='bookmark' title='Permanent Link: Determining Permissions for a User'>Determining Permissions for a User</a></li>
<li><a href='http://betweengo.com/2009/08/25/sqlplus-commit-on-exit/' rel='bookmark' title='Permanent Link: SQL*Plus Commit on Exit'>SQL*Plus Commit on Exit</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://betweengo.com/2008/07/02/sql-update-in-one-table-based-on-values-in-another/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Changing a user&#8217;s password</title>
		<link>http://betweengo.com/2008/04/23/changing-a-users-password/</link>
		<comments>http://betweengo.com/2008/04/23/changing-a-users-password/#comments</comments>
		<pubDate>Wed, 23 Apr 2008 17:26:19 +0000</pubDate>
		<dc:creator>Frank Kim</dc:creator>
				<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://betweengo.com/?p=175</guid>
		<description><![CDATA[Thanks to this article, Oracle/PLSQL: Change a user&#8217;s password in Oracle, it was quite simple to change a user&#8217;s password.
SQL&#62; alter user frank identified by password;


Related posts:Determining Permissions for a User
How to Import and Create Users in Oracle
Calling Oracle Stored Procedures and Functions



Related posts:<ol><li><a href='http://betweengo.com/2007/07/23/determining-user-permissions/' rel='bookmark' title='Permanent Link: Determining Permissions for a User'>Determining Permissions for a User</a></li>
<li><a href='http://betweengo.com/2009/07/17/how-to-import-and-create-users-in-oracle/' rel='bookmark' title='Permanent Link: How to Import and Create Users in Oracle'>How to Import and Create Users in Oracle</a></li>
<li><a href='http://betweengo.com/2007/01/22/calling-oracle-stored-procedures-and-functionis/' rel='bookmark' title='Permanent Link: Calling Oracle Stored Procedures and Functions'>Calling Oracle Stored Procedures and Functions</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Thanks to this article, <a title="Oracle/PLSQL: Change a user's password in Oracle" href="http://www.techonthenet.com/oracle/password.php">Oracle/PLSQL: Change a user&#8217;s password in Oracle</a>, it was quite simple to change a user&#8217;s password.</p>
<pre>SQL&gt; alter user frank identified by password;</pre>


<p>Related posts:<ol><li><a href='http://betweengo.com/2007/07/23/determining-user-permissions/' rel='bookmark' title='Permanent Link: Determining Permissions for a User'>Determining Permissions for a User</a></li>
<li><a href='http://betweengo.com/2009/07/17/how-to-import-and-create-users-in-oracle/' rel='bookmark' title='Permanent Link: How to Import and Create Users in Oracle'>How to Import and Create Users in Oracle</a></li>
<li><a href='http://betweengo.com/2007/01/22/calling-oracle-stored-procedures-and-functionis/' rel='bookmark' title='Permanent Link: Calling Oracle Stored Procedures and Functions'>Calling Oracle Stored Procedures and Functions</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://betweengo.com/2008/04/23/changing-a-users-password/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->