Showing posts with label oracle. Show all posts
Showing posts with label oracle. Show all posts

Thursday, 13 September 2012

Copy TOAD's Schema comparison sync script

TOAD does not allow you to copy the sync scripts created by it's schema comparison tool unless you shell out for the DBA Modules add in. All you can do is print it to a stupid xps file.

In order to get around this I created a small autoit script to copy the output to your clipboard.

Here is the code

Opt("WinTitleMatchMode", 1)

WinActivate("Toad for Oracle")

$Text=ControlGetText("Toad for Oracle","","[CLASS:TAdvToadSyntaxMemo; INSTANCE:1]")

ClipPut($Text)

If $Text Then 

   MsgBox(0,"pwnt","Copied to clip board")

Else

   MsgBox(0,"uh oh","Couldn't copy text. Has the schema comparison been run?")

EndIf

If need be, I might upload the compiled exe file.

Thursday, 4 March 2010

Selecting beginning of financial year in Oracle

I recently had to work out how to return the beginning of the financial year from an Oracle database. After trawling the internet, everything looked rather complicated for what I was after.



Below is what I came up with. It's pretty simple to change. If April is not the month you want to return, change the +4 at the end to the number of the month you want to return.



select trunc(add_months(sysdate, - (12 + to_char(sysdate,'MM'))+4),'MM')
from dual