Select entries between two dates by converting Unix timestamp in Oracle Database.


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Select entries between two dates by converting Unix timestamp in Oracle Database.
# 1  
Old 08-08-2006
Error Select entries between two dates by converting Unix timestamp in Oracle Database.

Hi,

I need to select the entries between two dates from an Oracle db. The Oracle db has a column with Unix timestamps. I use the following querry, but it doesnt seem to be working as desired.

select count(*) from reporter_status where to_char(FIRSTOCCURRENCE, 'mm-dd-yy') between ('08-07-06') and ('08-08-06');

FIRSTOCCURRENCE has the Unix timestamps.

Could anyone help me out with this. Thank you for your help.
# 2  
Old 08-08-2006
Since you are using to_char, FIRSTOCCURRENCE must of of datatype DATE.
So, UNIX has nothing to do with it.

Try
Code:
SELECT COUNT(*) 
FROM 
     REPORTER_STATUS
  WHERE  TRUNC(FIRSTOCCURRENCE) between to_date('08-07-2006','DD-MM-YYYY')
       and to_date('08-08-2006','DD-MM-YYYY');

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Timestamp between two dates

Hi, I want to find out the difference in minutes, and seconds between two dates for a job.Tried searching many ways but none of them worked correctly. eg: Start Time End Time 04/10/2015 02:02:27 04/10/2015 02:02:37 ---- should return 10s 04/10/2015 02:02:27 04/10/2015... (1 Reply)
Discussion started by: rogerben
1 Replies

2. Shell Programming and Scripting

Oracle Database connection from UNIX

Hi I have a question regarding Oracle connection using the below code ${ORACLE_HOME}/bin/sqlplus -s $user/$pwd@$sid <<!EOF 1>> $v_log_dir/$v_job_log.out 2>> $v_log_dir/$v_job_log.err / prompt stored procedure beginning . . . exec xx_interface_pkg.pr_xx_clms_out($datayears,$keepmonths); ... (3 Replies)
Discussion started by: smilingraja
3 Replies

3. Shell Programming and Scripting

How to run a SQL select query in Oracle database through shell script?

I need to run a SQL select query in Oracle database and have to capture the list of retrieved records in shell script. Also i would like to modify the query for certain condition and need to fetch it again. How can i do this? Is there a way to have a persistent connection to oracle database... (9 Replies)
Discussion started by: vel4ever
9 Replies

4. Shell Programming and Scripting

why do we need UNIX shell script to load data into Oracle database

Hello everyone, I am new to shell scripting/ loading data into a database. I want to load data into Oracle database using SQL loader. Can some one please explain why do we need unix shell script to load the data into the database? Also can someone please explain what has to be in that script?... (5 Replies)
Discussion started by: new_prog
5 Replies

5. Shell Programming and Scripting

Select multiple values from an Oracle database and assign it to two dimensional array

hi I have two tables in oracle DB and am using a joining query which will result in the output as follows. i need to assign it to a two dimensional array and use it for my further calculations. the way i tried is as follows. #!/bin/ksh export... (1 Reply)
Discussion started by: aemunathan
1 Replies

6. Shell Programming and Scripting

how to split the row(array) in to fields and store in to oracle database in unix

Hi, the csv file with the delimeter #. A#B#C#D#E#F#G#H 1#2#3#4#5#6#7#8 Z#x#c#V 7#2#8#9 N. I want to read the file line by line and store in rowarray. then the rowarray content should be spilt or made to fields using the delimeter #. i am not sure can we store the fields in to... (3 Replies)
Discussion started by: barani75
3 Replies

7. Shell Programming and Scripting

How to connect with oracle database using unix...

Hi all I am working in datawarehouse project and use DB2 database . shell scripting is written to connect with DB2 database in my application but i dont know how to connect with oracle databse or other databases.Is there any command in unix to connect any of these datbases? (6 Replies)
Discussion started by: vijays3
6 Replies

8. Shell Programming and Scripting

How to COnnect to Oracle database from UNIX Box

I am trying to connect to Oracle Databse from UNIX box using sqlplus command. But i get sqplus not found message. $ sqlplus sqlplus: not found I have searched in forums and all are suggesting to set environment varaibles...can somebody tell me what variables to set and how to set.and the... (12 Replies)
Discussion started by: angelarosh
12 Replies

9. Programming

converting unix timestamp into readable format using c++

hi everyone, im new here and am in desperate need of help. I want to convert my 32 bit unix time stamp ' 45d732f6' into a readable format (Sat, 17 February 2007 16:53:10 UTC) using c++. I have looked around the interent but i just cant make sense of anything. All examples i can find just... (3 Replies)
Discussion started by: uselessprog
3 Replies

10. Shell Programming and Scripting

unix script to export data from csv file to oracle database

Hello people, Need favour. The problem I have is that, I need to develop a unix shell script that performs recurring exports of data from a csv file to an oracle database. Basically, the csv file contains just the first name and last name will be dumped to an Unix server. The data from these... (3 Replies)
Discussion started by: vinayagan
3 Replies
Login or Register to Ask a Question