OCI8 Data Formatting

Hi Experts,

I would like to ask for your assistance again.

I am currently experiencing an issue in data formatting which will be explained below

I am trying to format number and date data to my desired output. Below table you can see the query and results I got from my Oracle Database

select shipment_gid, total_actual_cost, total_actual_cost_base, start_time from shipment where rownum <= 3;


DEMO.01064 3000 2957.099999999999909050529822707176208496 05/02/2016 09:00:00

GSK.01136 0 0 05/22/2016 09:18:00

DEMO.01066 2000 1971.400000000000090949470177292823791503 05/02/2016 13:10:00


Unfortunately, when I execute it in my .rb file, I get the following results:

Warning: NLS_LANG is not set. fallback to US7ASCII.

DEMO.01064,0.3e4,0.29570999999999999090505298227071762085e4,2016-05-02 09:00:00 +0000
GSK.01136,0.0,0.0,2016-05-22 09:18:00 +0000
DEMO.01066,0.2e4,0.19714000000000000909494701772928237915e4,2016-05-02 13:10:00 +0000


Below is my .rb file.

#! /usr/bin/env ruby

require ‘oci8’

#Create a connection to the Oracle Database

oci = OCI8.new(username,password,server)

#parse and exec the statement

cursor = oci.parse(‘select shipment_gid,total_actual_cost, total_actual_cost_base, start_time from shipment where rownum <= 3’)


#output column names

#puts cursor.getColNames.join(",")

#output rows

while r = cursor.fetch

puts r.join(",")


#close the cursor



puts ‘-’*80


Any ideas on how to format it properly and remove the Warning message? Thank you in advanced.