Posts

Showing posts from 2011

Updating a table using joins in Oracle

Scalar sub query UPDATE x SET foo = (SELECT y.foo FROM y WHERE y.bar = x.bar); Scalar sub query with existential predicate UPDATE x SET foo = ( SELECT y.foo FROM y WHERE y.bar = x.bar) WHERE EXISTS ( SELECT y.foo FROM y WHERE y.bar = x.bar); Updatable view (requires foreign key from x to y) UPDATE ( SELECT x.foo AS old_foo, y.foo AS new_foo FROM x, y WHERE y.bar = x.bar) SET old_foo = new_foo; Merge Update MERGE INTO x USING (SELECT foo, bar FROM y ) y ON (y.bar = x.bar) WHEN matched THEN UPDATE SET x.foo = y.foo; Note: WHEN NOT MATCHED construct is optional

Modify a column data type or size in Oracle

Modifying a column data type or size in Oracle is done by using the constructs below Changing the column data type: ALTER TABLE <Table name> MODIFY ( <Column Name> <New data type>) Changing the size of a column: (Assuming the previous data type of column was varchar2 with the length of 20 and it needs to be changed to 10) ALTER TABLE <Table name> MODIFY ( <Column Name> VARCHAR2(10)) Note: Text within <> indicate the parameters that need to be replaced.

Rename a column in Oracle

Renaming a column in Oracle is done by using the construct below ALTER TABLE <Table name> RENAME COLUMN <old column name> TO <new column name> Note: Text within <> indicate the parameters that need to be replaced.

Connecting to Oracle using SQL Plus

The following are the steps needs to connect to an Oracle database using SQL Plus Open command prompt - Windows > Run > cmd.exe Traverse to the path where oracle client is installed. In my case it is C:\Oracle\Ora11g_32\Client11g\bin Run the command sqlplus username/password@server

Most helpful command of Re-Sharper

Based on my experience with Re-Sharper the most useful keyboard command is the Alt + Enter. Using the same I am able to see the suggestions that Re-Sharper has to offer for me to make the code look right based on the rules set.

Re-Sharper 5.0 Cheat Sheets

The following are the links to the re-sharper 5.0 cheat sheets Visual Studio Schema  -  http://www.jetbrains.com/resharper/docs/ReSharper50DefaultKeymap_VS_scheme.pdf IDEA Schema -  http://www.jetbrains.com/resharper/docs/ReSharper50DefaultKeymap_IDEA_scheme.pdf