Obtain machine IP Address using Oracle SQL command

I never know this function has exist until I was required to explore Oracle APEX to design a website. Here is the code, which can get an IP address of machine and the value can be store into a database or pass it into other variable for processing, or whatever your programming do.

select sys_context(‘userenv’,’ip_address’)  from dual

Have fun.

Oracle Database Express Edition 11g Release 2 not work for 64bit OS?

Oracle Database 11g Express Edition (Oracle Database XE) is an entry-level, small-footprint database based on the Oracle Database 11g Release 2 code base.  

It’s free to develop, deploy, and distribute; fast to download; and simple to administer.


Oracle Database XE is a great starter database for:


  • Developers working on PHP, Java, .NET, XML, and Open Source applications
  • DBAs who need a free, starter database for training and deployment
  • Independent Software Vendors (ISVs) and hardware vendors who want a starter database to distribute free of charge
  • Educational institutions and students who need a free database for their curriculum


With Oracle Database XE, you can now develop and deploy applications with a powerful, proven, industry-leading infrastructure, and then upgrade when necessary without costly and complex migrations.


Oracle Database XE can be installed on any size host machine with any number of CPUs (one database per machine), but XE will store up to 11GB of user data, use up to 1GB of memory, and use one CPU on the host machine.


But, it also has a limitation. This XE does not offer to 64bit Operating System. I was wondering why? Perhaps it is due to Oracle strategy in terms of sales, which at the end will bring user to choose a upper version of Oracle database, Enterprise edition.


Well, it make sense. If Oracel to offer everything for free. How are they going to make money from their Oracle licensing revenue.


However, some information from the internet has say that Oracle Database XE can be install in 64bit operating machine, somehow. Well, I am about to test it and see how true the statement was.


See you in my next post about this.


If you wanted to know more about Oracle Database XE, you can go to Oracle website here.

What Does Windows x64 and x86 Mean?

Sometimes people will easily get confuse. Common sense perspective will easily says x86 is higher than x64. And some will miss interpret saying that x64 refer to 32bit and x86 is referring to 64bit operating system.

x64 is 64bit platform while x86 is 32bit platform for Operating System.

As the x86 term became common after the introduction of the 80386, it usually implies a binary compatibility with the 32-bit instruction set of the 80386. This may sometimes be emphasized as x86-32 to distinguish it either from the original 16-bit x86-16 or from the newer 64-bit x86-64 (also called x64). Although most x86-processors used in new personal computers and servers have 64-bit capabilities, to avoid compatibility problems with older computers or systems, the term x86-64 is often used to denote 64-bit software, with the term x86 implying only 32-bit.

How to check your PC Operating System running on what bit using Windows command prompt?

systeminfo <–type this and press Enter in command prompt

System Manufacturer:       LENOVO
System Model:              4236NUA
System Type:               x64-based PC
Processor(s):              1 Processor(s) Installed.
                           [01]: Intel64 Family 6 Model 42 Stepping 7 GenuineIntel ~775 Mhz
BIOS Version:              LENOVO 83ET61WW (1.31 ), 7/7/2011
Windows Directory:         C:Windows
System Directory:          C:Windowssystem32
Boot Device:               DeviceHarddiskVolume2
System Locale:             en-us;English (United States)
Input Locale:              en-us;English (United States)

Oracle Application Express (APEX) and ASP.NET

I am digging around of the benefit using Oracle Application Express (APEX) compare to ASP.NET in building my website for current job needs. Because I am getting the direction from superior to study and start using APEX instead of ASP.NET for my web development.

At first, when I look into Oracle website about APEX, I can imagine how easy my work will be. I mean the website will be easy to create, offer easy connectivity to Oracle database but still, I will need to connect my website to MSSQL server to store data input by user.

Anyway,let look at what other people has say about Oracle Application Express (APEX) versus ASP.NET (Visual Studio).

APEX is a framework that uses the database and PL/SQL to produce web pages. If you can figure out what the output to the browser will need to be you can create it in APEX. If you find any part of the framework inhibiting you can write PL/SQL procedures and expose them to the web server directly but still take advantage of the security, logging, session state, etc that the APEX system manages for you.

You should know PL/SQL, SQL, HTML, JavaScript and CSS. Sure the interface looks like a big data entry application but the data you enter will mostly be code snippets in each of these languages.

It scales as well as the database does. It typically uses Apache as a web server but is only used to serve static files and pass requests back to the database, where the web pages are created by the PL/SQL code in the APEX schema. You can use AJAX to minimize the size of the traffic traveling up and down the pipe. You can set caching for specific items, lists, page regions, pages, etc. 

Since most things are pretty simple to do with the framework, naturally there will be some things that are a little more complicated to do within the framework. The color coding example given above might be something you do with CSS or maybe you would need to turn to print statements to produce the output you need. The thing is to learn the how the framework makes life easier and then when you hit a limit you can easily resort to more direct methods.

Coming from VB.Net you will miss the step by step debugging and the drag and drop. You will never miss the fact that some part of the page lifecycle will do a bind and reset the values you bound to an object in another part of the page.

This fella have a huge migration project. What has he say about APEX?

I am involved in a huge project to migrate a 5000 module Oracle Forms application to Apex. This is an extreme use of Apex, but it’s working just fine. It is a complete myth that Apex is suitable only for small internal apps built by DBAs, interns or end users: it is certainly suitable for those too (and more suitable than most other tools), but it can also be used to build extremely sophisticated applications. 

To build a sophisticated application (rather than a default out-of-the box Apex one) you will need someone on the team with Javascript skills, and someone with CSS skills. But most developers will just need PL/SQL initially. 

Is it scalable? Yes: probably more scalable than most other solutions! Apex adds very little overhead to the database server, and only the most minimal of application servers is required. “Facebook size”? I don’t know for sure but I don’t see why not, assuming you have an Oracle database on a machine large and powerful enough to handle “Facebook size” data and transaction volumes. Like any Oracle project, scalability is impeded mostly by bad database designs and poorly written SQL, not by the tool.

The good side of APEX has been discussed too.

The Good

  • Incredibly easy to generate a respectable web app with basic CRUD data entry, simple reporting and populate it with data. If you’re the IT guy who’s been tasked with consolidating a company’s mess of Excel/Access dbs into a central DB/web environment then you should take a look at APEX, it very well suited for this task. If you expect the scope to grow to something of even moderate complexity then I would move straight to a more flexible framework.
  • If you are a DBA/PLSQL guru but have no experience with traditional web development you’ll be well prepped to expose existing business logic in a web app without stuffing around with HTML/CSS/JavaScript if you dont want to.
  • APEX support forum has a ton of info and is well staffed by APEX devs.

Take a look into the bad site of APEX compare to ASP.NET.

The Bad

  • My experience with Apex began to go downhill when apps moved beyond CRUD data entry and required more dynamic and event driven behaviours.
  • The web based GUI is not cool. Debugging is painful.
  • When you (inevitably) need to do anything outside the limited scope of the framework, you’ll have to get your hands dirty with PL/SQL. Writing business logic against the database is fine, but generating HTML from PL/SQL procedures felt uncomfortably archaic in 2007.
  • Given the large number of sneaky places you can hide page and redirection logic, the program flow is both difficult to visualise and not naturally conducive to modular, separable and reusable code. OOP developers will be not be impressed. It’s possible to have well structured maintainable applications with APEX but its harder than it should be. This is worlds away from MVC.
  • Unacceptable number of framework bugs in the versions I used. I’d hope this has improved with recent versions, but the paradigm of integrating the IDE into the APEX platform itself caused me some of the darkest, soul destroying debugging sessions of my life. As an example, I was trying to reproduce an intermittent bug that would cause a user to lose their session data. Using the session information popup I saw that occasionally the session data would change when it shouldnt have. I spent 2 days trying to find the error in my code with no luck. Near delirious, I noticed by pure chance that I could reproduce errorous session data in the debug window but the application itself wouldnt go into an error state. My heart sunk when I realised what might be happening. Oracle later confirmed that I’d found a bug in APEX that caused the session information window to intermittently show me data from a prior session. I’d wasted 2 days debugging a session related bug with a buggy session debug window. That was the last Apex app I built.
  • PL/SQL is not and will never be the Next Big Thing in web development. After working with APEX for a while I realised it wasnt going to make me a better web developer. Mastering APEX is really about PL/SQL. Thats fine if you plan to focus your career on Oracle technology, just be aware that APEX is so tangential to the direction of mainstream web technologies that the portable set of skills you can take from APEX to other web frameworks is minimal.

Optimize Your Blogger Blog Titles For SEO Friendly

There are so many blogger template available over the internet for you to download. However, if you would like to use template which has provided default by Google, some of blogger say it may be useful to alter the blog title instead using default by Google.

What will this alteration do? Basically if you look into your blog post title on the top of the browser, it will normally display as YourBlogName: BlogTitle. Well, after we alter some coding in the file, the blog post title will change to just BlogTitle, which the YourBlogName will disappear. In Search Engine Optimization perspective, this changes will helps to improve SEO merit.

How to Change Blog Titles for SEO

1. Log in to your Blogger Dashboard and go to Template > Edit HTML
2. Find (CTRL + F) this code:


3. Replace the code above with this one:

<b:if cond=’data:blog.pageType == “item”‘>
<title><data:blog.pageName/> |<data:blog.title/></title>
<title><data:blog.pageTitle/></title> </b:if>

4.Click Save Template and you are done.

ASP.net how to execute query to Oracle using Button click

I would like to share a simple code which currently I am doing. This is a very basic application you may design for your website and require a database connection to Oracle databases.
First, lets go to the design of it. This is truely very useful for beginner like me especially you do not know where to start with. I am using Microsoft Visual Studio 2012 for Web to design my application website.

Second, talk about the Oracle connection string. I have quite sometime searching for correct oracle connection string that works (on my machine at least). You may copied it over, hopefully it will works on you too. Please change where necessary in the string follow your server configuration and setting.

“Data Source=(DESCRIPTION=” _
+ “)” _
+ “)” _
+ “);” _


Now, when you double click on Button from the project, it will bring you to the new coding page. This file is normally ended with *.vb filename. Here will be the location to paste the Oracle connection string as pasted above. Below is how the code will be looks alike:

Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        ‘Your Oracle connection Setting
        Dim strConnString As String = “Data Source=(DESCRIPTION=” _
                                    + “(ADDRESS_LIST=” _
                                    + “(LOAD_BALANCE=YES)” _
                                    + “(FAILOVER=YES)” _
                                    + “(ADDRESS=(PROTOCOL=tcp)(HOST=YOUR_HOST_NAME)(PORT=YOUR_PORT))” _
                                    + “(ADDRESS=(PROTOCOL=tcp)(HOST=YOUR_HOST_NAME)(PORT=YOUR_PORT))” _
                                    + “)” _
                                    + “(CONNECT_DATA=” _
                                    + “(SERVICE_NAME=YOUR_SERVICE_NAME)” _
                                    + “)” _
                                    + “);” _
                                    + “User ID=YOUR_USER_ID;Password=YOUR_PASSWORD;” 
        ‘Your sql statement goes here
        Dim strQuery As String = “SELECT cus_name from  tbl_cus where cus_ID = ‘” + TextBox1.Text + “‘”
        Dim con As New OracleConnection(strConnString)
        Dim cmd As New OracleCommand()
        cmd.CommandType = CommandType.Text
        cmd.CommandText = strQuery
        cmd.Connection = con
            Dim sdr As OracleDataReader = cmd.ExecuteReader()
            While sdr.Read()
                ‘Here will be your output result
                Label1.Text = “Item”
            End While
        Catch ex As Exception
            Throw ex
        End Try

    End Sub

Above code working just fine when I debug the project and click the button. This may help you to explore more on query to Oracle database for your project.

How to solve TOAD Error “00.00.0000 00:00:00” is not a valid date and time

There is something weird about my TOAD when I tried to export query result from my TOAD application into Excel file. The error was something like this : “00.00.0000 00:00:00” is not a valid date and time.
I spent a lot of time searching for solution for this error. Luckily I was not so urgently need the data. I have time to google it and find the solution. It is so true when finally I found that it was actually related to Real Player installation in my machine. I do not know why this Real Player download and installation affected to my TOAD program, but this is really a bug which Real staff needed to be notify.
After searching over the net, you may wanted to try listed step I have provided as below.

  1. Simply open TOAD, go to Utilities > Task Scheduler (this is somehow will trigger the error pop-up again)
  2. From the task listed, locate for RealCreateProcessScheduledTask***** (it has a longer character than this)
  3. Delete this task 

If above step was not so succesfull, you may need the other way around. Actaully above step was not working for me. Below step truely works. You may need a command promt running to delete this task, because normal Task Scheduler will not give you the complete list of task when running on your machine.
My machine running Windows 7 Pro, and to accomplish this, I need a full administrator access to delete this task. How to do that?
Find command.exe from your WindowsSystem32 folder. Right Click and click “Run as Administrator”. When the command prompt has appear, do the following:

  1. Type ‘schtasks /query | more‘ and enter to list all current task
  2. Locate the RealCreateProcessScheduledTask***** and copy it over (make sure you copied all full task name of this. If you screen limit it, you can copy the full task name from the TOAD program)
  3. Excute this command ‘schtasks /delete /tn [ProblemTask]‘, which [ProblemTask] is referring to RealCreateProcessScheduledTask***** (full task name).
  4. You will see a prompt notification to confirm deletion, press Y and Enter.
  5. Now you can do export in TOAD with no more error.

Please leave a comment below if you want to add anything.

Problem with string which contains an “&” in sqlplus

Today I got a task to automate data extraction for reporting purpose from Oracle SQL Plus. My method for this automation is like below:

1. Create a batch file to call SQL Plus program.
2. The SQL PPlus program will generate a HTML report for my boss to view it.

As simple as that. And my tools required are:

1. A simple *.bat file (which to create a automatic daily folder to restore the report)
2. SQL Plus program
3. A sql script will able to produce a HTML report (this is quite tough one). I can post on how to do this maybe later.

So, my problem is, in my script there is a compulsory string [&]. Which you may already know, the string [&] is being used by ORACLE to identify variable.

This is the solution:


This command line needed to be put inside the sql file before reaching [&] string, and it will stop sqlplus interpreting [&].

Thats all for today.

Interesting Google Chrome Web Tools to capture a whole web page

For most of internet user, getting a snapshot of a web, or a picture from the web, is very common and sometimes it is difficult to mange.

But with Google Screen Capture for Google Chrome,to save a screenshot of a page is very interesting yet very easy to use. The best part of it, which I personally think very important and most interesting, this tool manage to capture the whole webpage from top to bottom of page. I love it so much!

Below are the simple step to install.

1. You will need a Google Chrome installed. If you do not have it, grab it here.
2. Open your chrome and click on the [Web Store] button located at right bottom of the Chrome page.
3. Search for [Google]
4. Scroll down and look for Google Screen Capture, and install it.

This is great tool, very much love it. Enjoy.

Problem open TOAD after install : You have no Oracle Client installed.

I encounter a problem with my TOAD for Oracle just now. It mentioned You have no Oracle Client installed .Wondering what is the problem and below was the screenshot of it.

You have no Oracle Client installed

The solution is very simple. And I also found the root cause of it.

Root cause: Toad do not support Oracle Client for 64 bit. As simple as that

Solution : Install Oracle Client 32 bit. You may install another copy of Oracle client, or you may remove the 64 bit which you previously installed.

To be particular, my machine was a Windows 64 bit platform, and I directly apply Resolution 2 as below.

Below are the statement from the Quest Software support site.
For more detail from the site: https://support.quest.com/Search/SolutionDetail.aspx?id=SOL39689
– There is no Oracle client installed on the machine or the client installed is 64-bit. Toad does not support a 64-bit Oracle client.
– Environment Variable Path is missing.

Solution for ‘You have no Oracle Client installed’ :

Check to make sure there is an Oracle client installed on your machine. If there is not, you will need to install one. Please review solution SOL76452 for video demo and instructions on installing a 32-bit Oracle Instant Client. See additional information below for link to full 32-bit Oracle Client

If there is an Oracle client installed on the machine, check to see if it is 64-bit. If it is, you will need to install a 32-bit Oracle client.

1) Look for your OCI.DLL file in your computer and Copy the location path i.e. C:oracleproduct10.2.0client_1BIN
2) Right-Click your My Computer | Properties | Advanced Tab | Environment Variables button
3) Under ‘System Variables’ at lower half of screen, highlight ‘Path’ | click Edit
4) Under ‘Variable Value:’ | go to the very beginning of the existing entry | Paste the path you copied earlier
5) Add a semi-colon (;) | and then click OK, OK, OK.
6) Start Toad and re-test

You installed an Oracle Client 10g version in a Windows 64-bit machine. There is an issue with the Oracle Client 10g version on a Windows 64-bit machines where 3rd party Oracle Tools like Toad for Oracle will not be able to see the client. Possible resolutions for this are:
– Install Toad in “C:Quest Software” folder instead of the default “C:Program Files (x86)” folder.
– Install and use Oracle Client 11g version instead. See the download link below for the client we recommend.

To download Oracle 11g Client software:
11g 64bit client
11g 32bit Client
You may need a Oracle Metalink account to download it.