Sample Query In TOAD using a 'date' variable:
====================================================================
declare dt date;
pp varchar(100);
begin
dt:=TO_DATE('2008/04/25', 'yyyy/mm/dd');
select CEIL((SYSDATE - 180) - Decode(dt,null,(SYSDATE - 180),dt)) into pp from dual;
dbms_output.PUT_LINE(pp);
end;
Tuesday, October 21, 2008
Monday, September 22, 2008
Lyrics of Oho kiku eruthe
Lyrics of Oho kiku eruthe
Movie name:Padiyappa
Starring: Rajanikanth, Soundarya
Music: A R Rahman
Singer: SPB
Language: Tamil
ohoho kicku yerudhe
ohoho vetkam ponadhe
uLLukkuley nyaanam oorudhe
uNNmai ellaam solla thonudhe
verum kampangali thinnavanum mannukkuLLa
ada thangapaspam thinnavanum mannukkuLLa
indha vaazhkai vaazha thaan
naam pirakkayil kaiyil enna kondu vandhom kondhu sella?
(ohoho..)
paNaththai pooti vaithai
vairathai pooti vaithai
uyirai poota edhu pootu?
kuzhandhai nyaani, indha iruvarai thavira
inge sugamaai iruppadhu yaar kaatu
jeevan irukkummattum
vaazhkai namadhumattum
idhudhaan nyaanasidhdhar paatu
indha bhoomi samam namakku
nam theruvukkuL
madasandai jaadhidsandai vambyerdharkku?
(ohoho...)
thaayai therndhekkum
thandhayai therndhekkum
urimai unnidhathil illai
mugaththai therndhekkum
niraththai therndhekkum
urimai unnidhathil illai
pirappai therndhekkum
irappai therndhekkum
urimai unnidhathil illai
eNNi paarkkum vELaiyil
un vaazhkai mattum
undhan kaiyil undu
adhai vendridu!
Movie name:Padiyappa
Starring: Rajanikanth, Soundarya
Music: A R Rahman
Singer: SPB
Language: Tamil
ohoho kicku yerudhe
ohoho vetkam ponadhe
uLLukkuley nyaanam oorudhe
uNNmai ellaam solla thonudhe
verum kampangali thinnavanum mannukkuLLa
ada thangapaspam thinnavanum mannukkuLLa
indha vaazhkai vaazha thaan
naam pirakkayil kaiyil enna kondu vandhom kondhu sella?
(ohoho..)
paNaththai pooti vaithai
vairathai pooti vaithai
uyirai poota edhu pootu?
kuzhandhai nyaani, indha iruvarai thavira
inge sugamaai iruppadhu yaar kaatu
jeevan irukkummattum
vaazhkai namadhumattum
idhudhaan nyaanasidhdhar paatu
indha bhoomi samam namakku
nam theruvukkuL
madasandai jaadhidsandai vambyerdharkku?
(ohoho...)
thaayai therndhekkum
thandhayai therndhekkum
urimai unnidhathil illai
mugaththai therndhekkum
niraththai therndhekkum
urimai unnidhathil illai
pirappai therndhekkum
irappai therndhekkum
urimai unnidhathil illai
eNNi paarkkum vELaiyil
un vaazhkai mattum
undhan kaiyil undu
adhai vendridu!
Friday, September 5, 2008
How to use TOAD for to write oracle PL SQL?
1. Multiple SELECT statement can not be executed in TOAD
2. Simplest PL/SQL code in TOAD
DECLARE iDocID NUMBER(6);
BEGIN
SELECT COUNT(*) INTO iDocID FROM TBL_TW_DOCS;
DBMS_OUTPUT.PUT_LINE(iDocID);
END;
3. If a statement is returing more than one value(i.e rowset), then we can not execute using BEGIN and END.
Therefore,following code does not execute in TOAD and thows error:
4. Simplest correct code:
5. Opening an Oracle Stored Procedure ( compiled object ) in TOAD
a) Click on new procedure window.
b) New procedure window appears as follows
c) Click on Proc tab. Procedure TAB appears as follows.
d) Click on filter button and following screen appears where user is allowed to filder by package name or SP name
Thursday, August 21, 2008
Inserting into database using SqlBulkCopy Class (c#)
SqlBulkCopy:
SqlBulkCopy class which has been introduced .NET2.0 onwards allows bulk insertion into Sql Server database.
Limitation of using SqlBulkCopy:
1. Only insertion is allowed. We can not achive updation any single row of databse (sql server) while using SqlBulkCopy class.
2. We can insert into SqlServer database only.
3. While inserting into db, SqlBulkCopy does not do any validation. SqlBulkCopy takes data "as is" and tries to insert data into Sql Server database.
For an example, say if you have column of type DateTime in Sql Server database. While using SqlCommand a string value is aumatically converted into DateTime in database. But in same scenario SqlBulkCopy fails.
If you have datatime column in Database, in memory also you need to have a datetime type column.
The bottomline is : SqlBulkCopy does not do any data validation or conversion for you. Therfore using SqlBulkCopy class error creps in frequently. Programmer need to take care of data validation also.
Advantage of SqlBulkCopy:
It inserts values much faster way that any other.
Programming Scenario:
You may come across following programming scenario
------------------------------------------------------------------------
Data source_____ Data destination
------------------------------------------------------------------------
1. A table in Sql Server_-----A table in Sql Server
------------------------------------------------------------------------
2. In memory----------------------------------------------------
--data representation-----------------------------------------
i.e. a DataTable object--------A table in Sql Server--
------------------------------------------------------------------------
3.Oracle or------------------ ------------------------------------
Other database-------------------A table in Sql Server
------------------------------------------------------------------------
4. Sql Server-----------------------A table in Sql Server
------------------------------------------------------------------------
Following is code shown for programming scenario 2
Assumtion:
1. "dtLog" is a DataTable with data.
2. Sql Server database table name is stored into app.config file.
3. Sql Server database table structure is like following
The table is having a identity column: RowID
3. UpdateDatbase() function takes the a DataTable object as parameter and inserts all rows
into Sql Server DataBase.
CODE:
private void UpdateDatabase(DataTable dtLog)
{
SqlBulkCopy bulkCopy = null;
Stopwatch sw = new Stopwatch();
sw.Start();
SqlBulkCopyColumnMapping map1 = null, map2 = null, map3 = null, map4 = null, map5 = null, map6 = null, map7 = null, map8 = null, map9 = null, map10 = null, map11 = null, map12 = null,map13 = null;
try
{
bulkCopy = new SqlBulkCopy (Settings.Default.DBConnString ,SqlBulkCopyOptions.KeepIdentity);
map1 = new SqlBulkCopyColumnMapping("EngagementId", "EngagementId");
map2 = new SqlBulkCopyColumnMapping("EngagementName", "EngagementName");
map3 = new SqlBulkCopyColumnMapping("SyncGroup", "SyncGroup");
map4 = new SqlBulkCopyColumnMapping("SyncStartTime", "SyncStartTime");
map5 = new SqlBulkCopyColumnMapping("ClientSelectChangeStart", "ClientSelectChangeStart");
map6 = new SqlBulkCopyColumnMapping("ClientSelectChangeEnd", "ClientSelectChangeEnd");
map7 = new SqlBulkCopyColumnMapping("ServerApplyChangeStart", "ServerApplyChangeStart");
map8 = new SqlBulkCopyColumnMapping("ServerApplyChangeEnd", "ServerApplyChangeEnd");
map9 = new SqlBulkCopyColumnMapping("ServerSelectChangeStart", "ServerSelectChangeStart");
map10 = new SqlBulkCopyColumnMapping("ServerSelectChangeEnd", "ServerSelectChangeEnd");
map11 = new SqlBulkCopyColumnMapping("ClientApplyChangeStart", "ClientApplyChangeStart");
map12 = new SqlBulkCopyColumnMapping("ClientApplyChangeEnd", "ClientApplyChangeEnd");
map13 = new SqlBulkCopyColumnMapping("SyncEndTime", "SyncEndTime");
bulkCopy.ColumnMappings.Add(map1);
bulkCopy.ColumnMappings.Add(map2);
bulkCopy.ColumnMappings.Add(map3);
bulkCopy.ColumnMappings.Add(map4);
bulkCopy.ColumnMappings.Add(map5);
bulkCopy.ColumnMappings.Add(map6);
bulkCopy.ColumnMappings.Add(map7);
bulkCopy.ColumnMappings.Add(map8);
bulkCopy.ColumnMappings.Add(map9);
bulkCopy.ColumnMappings.Add(map10);
bulkCopy.ColumnMappings.Add(map11);
bulkCopy.ColumnMappings.Add(map12);
bulkCopy.ColumnMappings.Add(map13);
bulkCopy.DestinationTableName = Settings.Default.DBTableName.Trim();
bulkCopy.WriteToServer(dtLog);
}
catch (Exception ex)
{
errorCount++;
ApplicationLog(String.Format("Exception in UpdateDatabase. Message : {0},StackTrace {1}", ex.Message, ex.StackTrace));
}
finally
{
sw.Stop();
bulkCopy = null;
txtResult.Text = (sw.ElapsedMilliseconds / 1000.00).ToString();
map1 = null; map2 = null; map3 = null; map4 = null; map5 = null; map6 = null; map7 = null; map8 = null; map9 = null; map10 = null; map11 = null; map12 = null; map13 = null;
}
Friday, July 18, 2008
OOPs with C# - Session 1
The concept of object orientted programming introduces a new concept which is known as class.
A class is a basic building block of object oriented programing.
Syntax:
class A
{
}
Regarding access modifier of class:
class access modifier = {public,protected,private}
1. In most cases we mention public or protected to be the access modifier of a class. Very few case we can encounter where we mention private to be access modifier of a class.
Q. What happens if we declare a class private?
A class is a basic building block of object oriented programing.
Syntax:
{
}
Regarding access modifier of class:
class access modifier = {public,protected,private}
1. In most cases we mention public or protected to be the access modifier of a class. Very few case we can encounter where we mention private to be access modifier of a class.
Q. What happens if we declare a class private?
How Object Oriented Programming came into picture
1. Procedural programming: the program is written as a collection of actions (a procedure) that are carried out in sequence, one after the other. The order is important.
----- Structured programming can be seen as a subset or subdiscipline of procedural programming, one of the major programming paradigms.
----- At a low level, structured programs are often composed of simple, hierarchical program flow structures. These are regarded as single statements
______________Programming Paradigm
_______________________|
_______________________|___________________
___|_______________________________________|
Unstructured Programing________________ structured Programing
___________________________________________|
___________________________________________|_________________
____________________|________________________________________|
___________Procedural Programing ___________________ Object Oriented Programing
1. Unstructured Programing: Most simplest way of doing programing. Just sequence of instructions to be executed to achieve the task.Does not follow any structure(no program structure and no data structure). So there is no methods or procedure in this kind of programing.
2. Structured Programing: This solicites for a breaking the whole task into multiple subset of instruction. This subsets are methods or procedure.
Advantage over Unstructured Programing:
1. Better Code maintanace
2. Better Reusability of code
3. Object Oriented Programing
Consider all real life entities as objects.
Introduces concepts of class.
Advantage over Unstructured Programing:
1. Better code reusuability
2. Better code maintanence
3. Data Encapsulation
4. Data hiding
Comparision:
----- Structured programming can be seen as a subset or subdiscipline of procedural programming, one of the major programming paradigms.
----- At a low level, structured programs are often composed of simple, hierarchical program flow structures. These are regarded as single statements
______________Programming Paradigm
_______________________|
_______________________|___________________
___|_______________________________________|
Unstructured Programing________________ structured Programing
___________________________________________|
___________________________________________|_________________
____________________|________________________________________|
___________Procedural Programing ___________________ Object Oriented Programing
1. Unstructured Programing: Most simplest way of doing programing. Just sequence of instructions to be executed to achieve the task.Does not follow any structure(no program structure and no data structure). So there is no methods or procedure in this kind of programing.
2. Structured Programing: This solicites for a breaking the whole task into multiple subset of instruction. This subsets are methods or procedure.
Advantage over Unstructured Programing:
1. Better Code maintanace
2. Better Reusability of code
3. Object Oriented Programing
Consider all real life entities as objects.
Introduces concepts of class.
Advantage over Unstructured Programing:
1. Better code reusuability
2. Better code maintanence
3. Data Encapsulation
4. Data hiding
Comparision:
| Unstructured Programing | Structured Programing | Object Oriented Programing |
code reusuability | less | medium | more |
code maintanence | Most difficult | medium | Most easier |
Data Encapsulation | No | No | Yes |
Data hiding | No | No | Yes |
Error: The following module was built either with optimization enabled or without debug information
Fix: Please do the following steps
1. From menu, select Tools then Options.
2. Once options is clicked following screen appears.
3. Select General under Debugging
4. Uncheck the checkbox beside Want if no user code on launch.
Fix: Please do the following steps
1. From menu, select Tools then Options.
2. Once options is clicked following screen appears.
3. Select General under Debugging
4. Uncheck the checkbox beside Want if no user code on launch.
Monday, June 23, 2008
Finally Puzzle !!!
As usual I was trying to play with try catch block of .NET 2.0 today ..( hey guys I am assureing you that its not going to be another nerd's den of .NET) and loved to see that agian I was forgetting some key points of that !!!
Just to summarise what I am going to put together, consider the following code snippet ...
try
{
// any code here
}
finally
{
Console.WriteLine("String Value 1");
Console.WriteLine("String Value 2");
}
try
{
// any code here
}
finally
{
Console.WriteLine("String Value 1");
}
Console.WriteLine("String Value 2");
Tuesday, January 29, 2008
Lyrics: Vairamuthu
Singer: Minmini, Shubha
Bakthi Paadal Phadattuma
Paalum Thenum Odattuma
Santhosham Kaanbhoma
Samikku Pushpangal Vendaama
Sambo Sambo Sambo Sambo
Sayangalam Vambo Vambo
Boomi Thandi
Pogamal
Saagamal Mothchangal Kanbom Ippo
Utchi Megam Ennai Parthathum
Konjam Neer Senthum Allava
Uppu Katru Ennai Theendinaal
Satre Thithikkum Allava
Ennai Pen Kettu Caesar Vanthaan
Endhan Pinnale Hitler Vanthaan
Yaarum Illatha Nerathilae
Sollamal Bramman Vanthaan
Medai Pottu Methai Kollavae
Jadai Seithale Podhumae
Engal Veetu Kashmir Kambali
Iruvar Kulirthanga Koodumae
Indha Mogathil Enna Kutram
Kadal Yogathin Utcha Kattam
Andha Sorgathil Saerkattuma
Inndraikku Unnai Mattum
NB : Thanks to http://www.mohankumars.com where I found the above lyrics.
Singer: Minmini, Shubha
Bakthi Paadal Phadattuma
Paalum Thenum Odattuma
Santhosham Kaanbhoma
Samikku Pushpangal Vendaama
Sambo Sambo Sambo Sambo
Sayangalam Vambo Vambo
Boomi Thandi
Pogamal
Saagamal Mothchangal Kanbom Ippo
Utchi Megam Ennai Parthathum
Konjam Neer Senthum Allava
Uppu Katru Ennai Theendinaal
Satre Thithikkum Allava
Ennai Pen Kettu Caesar Vanthaan
Endhan Pinnale Hitler Vanthaan
Yaarum Illatha Nerathilae
Sollamal Bramman Vanthaan
Medai Pottu Methai Kollavae
Jadai Seithale Podhumae
Engal Veetu Kashmir Kambali
Iruvar Kulirthanga Koodumae
Indha Mogathil Enna Kutram
Kadal Yogathin Utcha Kattam
Andha Sorgathil Saerkattuma
Inndraikku Unnai Mattum
NB : Thanks to http://www.mohankumars.com where I found the above lyrics.
Subscribe to:
Posts (Atom)