In this 2011, I feel like myself to take almost certification of what I know and what I'm using in my development space. Being programmer, I didn't say almost certificates are needed but just like non-computer science graduated like me, those certificate are very needed. Because almost people won't know why I'm surviving in IT without having computer science graduate. That's why I believe I'm not wrong to take certificate.
When I was in Myanmar, we use Microsoft SQL as our database because which is simple and easy to use with their UI. When I started working in Singapore (2009), our company use Oracle as database system instead of Microsoft SQL. Since that time, I'm addictive at Oracle because of the way of writing stored procedure, functions and views. That's why I think I need to have at least one Oracle certificate to let people know that I know Oracle.
That's why I decided to take 1Z0-051 exam of Oracle. It's called SQL Fundamentals exam which is suitable for me to take as beginner state of Oracle developer. Below is the exam topic of 1Z0-051.
In my life, mySQL database is very touch to use. Because it's very complicated to add or remove data column, rename the table name and inserting demo data without installing phpMyAdmin. That's why I decided to remove mySQL as my project database and to install SQL 2005 server Express version.
So, download both of SQL 2005 Server and also management studio express version. Honestly, installing of SQL 2005 express version is very simple and easy. Because, my before time I've used to develop Coldfusion Project with SQL server. That's why I can say it's simple. Unfortunately, I encountered the following error when I tried to connection SQL 2005 server in Coldfusion Administrator.

This week is very busy time for me. Because I have to implement HL7 segment with Oracle Stored Procedure. As we all know, Oracle SQL command isn't that same with Microsoft SQL. That's why some of command are very complicated for me to implement. Today, I need to retrieve the only one latest record from table with Oracle. In Coldfusion, it's very easy. To put maxrows = "1" and descending in query as follow:
2 SELECT U_ID FROM TBL_USER
3 ORDER BY U_ID DESC
4</cfquery>
In Microsoft, it's very simple. To put TOP command and descending in query as follow:
2ORDER BY U_ID DESC
In Oracle, it's not that easy. If we put ROWNUM and descending in query, the first record will be returned. Because ROWNUM doesn't work with Order By descending in query. That's why we need to do with query with query formula in Oracle as follow:
2 (SELECT U_ID FROM TBL_USER
3 ORDER BY U_ID DESC) CLONE_USER
4WHERE ROWNUM = 1
Phweee...!!! Oracle crack my brain again. :)
Today I have to retrieve data from the largest table of my project in Oracle. Approximately, this table has more than 1 million records and need to retrieve data carefully when we need. Now what I need to do is to retrieve negative quantity from this table.
There are two ways to retrieve negative quantity from the table. One is systemically and second is simple way.
2 select * from nh_inv_trx_tmp
3 where transaction_date < '7-Jan-2008'
4 and abs(quantity) <> quantity
5</cfquery>
2 select * from nh_inv_trx_tmp
3 where transaction_date < '7-Jan-2008'
4 and quantity < 0
5</cfquery>
In Microsoft SQL, we can trace currently which SQL query takes execution time and load of each SQL query in SQL Profiler. In Oracle, what should we do? It's not that simple like Microsoft SQL. Open TOAD and login as SYSTEM authentication. Then type following statement into TOAD SQL.
2MYDSN is simple database of mine.
3Put your database name instead of MYDSN.
4--->
5
6SELECT * FROM V$SESSION WHERE STATUS = 'ACTIVE' AND USERNAME = 'MYDSN'
Run this query. After that, all active query will be displayed and note which query execution time takes so long.
Copy two tables in Oracle
Dec 30
I found that so many query statements are different between in Microsoft SQL and Oracle. To copy two table in the same database with Microsoft SQL, I normally use SELECT INTO statement as follow.
2<cfquery name="qryCopy" datasource="myDSN">
3 SELECT *
4 INTO tblPerson_Backup
5 FROM tblPerson
6</cfquery>
7
8<!--- For specific data field --->
9<cfquery name="qryCopy" datasource="myDSN">
10 SELECT NAME, DOB, SEX
11 INTO tblPerson_Backup
12 FROM tblPerson
13</cfquery>
Normally, I always use maxrows attribute of CFQuery when I want to display limited records from table. Sometimes I want to display limited records from table with built-in Microsoft SQL command like TOP in Oracle. Yesterday I found that there is ROWNUM command in Oracle which can display limited records like maxrows in CF and Top in SQL. That's why I feel happy to use this command in my query. On the other hand, I want to test the performance between maxrows and rowcount.
So I've tested as follow
With maxrows
2 select NAME, DOB from nh_person
3</cfquery>
Query execution time for above statement is 31ms and debugging output is as follow
Today, I need to develop simple function in Oracle about data retrieving. As I mention in previous post, I'm very new to Oracle and don't know much of Oracle command and attributes. That's why I seek some information and develop simple function for it. In some information, I found two way to insert query data into variable as follow:
first one
2 myvar varchar2(50);
3BEGIN
4 SELECT fieldone into myvar FROM tbl_one WHERE id = 1;
5END;
second one
2 myvar varchar2(50);
3 CURSOR L1 IS
4 SELECT fieldone FROM tbl_one WHERE id = 1;
5BEGIN
6 OPEN L1;
7 FETCH L1 INTO myvar;
8 CLOSE L1;
9END;
Create Function in Oracle
Sep 18
I'm very new to Oracle because I'm start using Oracle when I reach here. When I was in Myanmar, our RDBMS is Microsoft SQL. In MsSQL, GUI is very simple and for example: if you need your ID as auto increment, set identity to true/yes in Ms.SQL properties. In Oracle, we need to create trigger for auto increment. Today, I feel like myself to create Function in Oracle for convert number format to Ordinal Format which I already created in CF UDF. Why I created the same Function in Orcale is because I want to generate report by using cfreport tag.
Here is my simple Function
2 --Input parameter from outside
3 ( cycle IN varchar2 )
4 RETURN varchar2
5IS
6 --Output parameter from function
7 ordinalformat varchar2(5);
8BEGIN
9 if ((mod(cycle,10) = 1) AND (mod(cycle,100) = 1))then
10 ordinalformat := 'st';
11 elsif
12 ((mod(cycle,10) = 2) AND (mod(cycle,100) = 2))then
13 ordinalformat := 'nd';
14 elsif
15 ((mod(cycle,10) = 3) AND (mod(cycle,100) = 3))then
16 ordinalformat := 'rd';
17 else
18 ordinalformat := 'th';
19 end if;
20RETURN cycle || ' ' || ordinalformat;
21
22EXCEPTION
23WHEN OTHERS THEN
24 raise_application_error(-20001,'An error was encountered - '||SQLCODE||' -ERROR- '||SQLERRM);
25END;
Execute this function in PL/SQL
2====
31 st

Android
Top of Page