torstai 3. huhtikuuta 2008

Replace a string in Oracle database field

update myTable a set someField = replace (a.someField,'Ä','A') where someField is not null;
update myTable a set someField = replace (a.someField,'Ö','ö') where someField is not null;
update myTable a set someField = replace (a.someField,'Å','A') where someField is not null;

Oracle Case-When example

select
product,
company,
case when category = 'Microsoft'
then 'Yes!!'
else 'No'
end as microsoft_spotted
from
products
;

List all tables in your Oracle database

select owner, table_name from all_tables;
select * from all_tables;
more on ss64.com

Howto register Dll and Exe in command-line

To un/register Dll:
c:\>regsvr32 "C:\Windows\System32\My.dll"
c:\>regsvr32 /u "C:\Windows\System32\My.dll"

To un/register Exe:
c:\>"C:\Program Files\MyAppLocation\My.exe" /REGSERVER
c:\>"C:\Program Files\MyAppLocation\My.exe" /UNREGSERVER

to kill a process from taskmanager from command-line

First you should check that process is really found at taskmanager. You can list processes with command TASKLIST. To kill a process use TASKKILL.
E.g. c:\>tasklist
To kill a process if you know it's process id (PID)
E.g. c:\>taskkill /pid 12345
To kill a process if you only know it's name
E.g. c:\>taskkill /im "winamp.exe"
To find a process if you know partial name
E.g. c:\>tasklist /fi "imagename eq win*"
For more examples
E.g. c:\>tasklist /?
E.g. c:\>taskkill /?

Some Error messages with possible solution in asp-pages

HTTP 500.100 - Internal Server Error - ASP error
Internet Information Services

Error:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC driver for Oracle][Oracle]ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
Solution:
You have mistyped your your database name. Check from tnsnames.ora it exists and is working. Check you can connect to database with SQLPlus.

HTTP 500.100 - Internal Server Error - ASP error
Internet Information Services

Error:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
Unspecified error
/website/some.asp, line 13
Solution:
Your database is not running. Start your database. Check you can connect to database with SQLPlus.