oracle and loop question


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers oracle and loop question
# 1  
Old 09-28-2006
oracle and loop question

Hi All,

I have a 2 questions; 1 is oracle and another is korn shell

say TIME=20060928
desired output: 20060927

say TIME=20061001
DESIRED output: 20060930

If i substract one day from 'TIME' i am looking for previous day.

can anyone please suggest me how do i do this is SQL.

i have another question; i am trying to write this is korn shell

KKK=a,b,c,d,e

if [ $KKK == 'a' or $KKK == 'c' or $kkk == 'e' ]; then
echo " i am here
else
echo " i am out"
fi

the above code that i wrote is not working.

can anyone please suggest me

thanks
mark
# 2  
Old 09-28-2006
Code:
#!/bin/ksh

KKK='a,b,c,d,e'

if [[ "${KKK}" = @(*a*|*b*) ]] ; then
   echo "[$KKK] IS [a,b]"
else
   echo "[$KKK] NOT [a,b]"
fi;

# 3  
Old 09-28-2006
Date conversion

Thanks a bunch

can anyone also please suggest me for the following

this is oracle question

say TIME=20060928
desired output: 20060927

say TIME=20061001
DESIRED output: 20060930

If i substract one day from 'TIME' i am looking for previous day.

can anyone please suggest me how do i do this is SQL.

thanks
mark
# 4  
Old 09-29-2006
Date conversion

Hi All,

thanks to all of you for your suggestions;
this is how I tried

SQL> select to_date('20060928', 'YYYYMMDD') - 1 from dual;

TO_DATE('
---------
27-SEP-06

my desired output in this case is 20060927 but here the output is
coming as 27-SEP-06.

can anyone please suggest me how do I get the output as 20060927


thanks a bunch
mark
# 5  
Old 09-29-2006
Code:
select to_char(to_date('20060928', 'YYYYMMDD') - 1 ,'YYYYMMDD')  from dual;


Last edited by anbu23; 09-29-2006 at 12:33 AM..
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to create a for loop statement for removing files listed in Oracle table?

Hello Frens, I am a newbie to shell scripting. I need a help on creating a for loop script (shell script) for removing files. I have a table called a_table with column name fil_name which contains all the files that need to be removed. Thank you in advance (6 Replies)
Discussion started by: manisha_singh
6 Replies

2. UNIX for Advanced & Expert Users

Question related to UNIX and Oracle DB

I have one application server, which is Solaris non global zone (dsapid02-dt3d02 - 10.63.76.96) and a database server, which is Linux (db1-serv26 - 10.63.36.117 & 10.63.36.118). Whenever database admin is starting listener, it starts filling listener log file. Within minutes, it will make file in... (6 Replies)
Discussion started by: solaris_1977
6 Replies

3. Programming

Oracle TRICk Question

HI Guys , Below are the two columns ITEMS and STATE of table . ITEMS STATE '2345','ggdh','k5tg','dgyt','hFF' DF '1234','ghyt','DDD','GHTD','ABF' PQ Can we get output in PL/SQL in below way ?... (7 Replies)
Discussion started by: Perlbaby
7 Replies

4. Programming

Oracle Loop question

HI , Please guide to get the PL/SQL logic to retrieve parameter VALUES passed IN variable seperated with comma(,) Say items =(MTH,WKL,DLY,QTR) It should send above parameters seperatly USING LOOP condition IN the below IN clause SELECT * FROM tb_data_storage WHERE items IN... (4 Replies)
Discussion started by: Perlbaby
4 Replies

5. Hardware

Sun/Oracle M5000 Question

I have an M5K with disk issues I'm trying to troubleshoot, and it's causing me some confusion. I know the host has four on-board HDDs, but the format command's output shows c0t0d0, c0t1d0, c3t0d0, and c3t1d0. cfgadm -al shows c0t3d0 as the DVD-ROM drive, and c1 and c2 as SAN disks. Confused yet? ... (2 Replies)
Discussion started by: desertdenizen
2 Replies

6. Shell Programming and Scripting

PERL and Oracle 11.2 question

Hi, we have PERL 64-bit build with Oracle 10g DBD . PERL database connection are working fine. Database upgraded to 11.2 and in PERL documents it says still use 10g DBD to connect to 11.2. when I try some test connections, I am getting this error . Did anyone see this error before . I set the... (2 Replies)
Discussion started by: talashil
2 Replies

7. UNIX and Linux Applications

Oracle DB Question

Hi, Where do i post Oracle DB related questions?? I basically have 2 questions - 1. What is pmon and smon? Difference between them? If either or both process fail then how can we monitor them? 2. Is lsnrctl same as tnslsnr? if i want to check for listener status then how would i do... (2 Replies)
Discussion started by: Mr. Zer0
2 Replies

8. Shell Programming and Scripting

BASH loop inside a loop question

Hi all Sorry for the basic question, but i am writing a shell script to get around a slightly flaky binary that ships with one of our servers. This particular utility randomly generates the correct information and could work first time or may work on the 12th or 100th attempt etc !.... (4 Replies)
Discussion started by: rethink
4 Replies

9. Shell Programming and Scripting

Error connecting oracle from inside while loop

Hi, I m trying to connect oracle database from inside while loop. I m trying to put the output of sql query in a flat file. Anyone please help me out. cat $FILE_NAME | \ while read da_name do $ORACLE_HOME/bin/sqlplus -s user_name/password@instance << EOF >> $OUTPUT_FILE select... (3 Replies)
Discussion started by: Devesh5683
3 Replies

10. Shell Programming and Scripting

Ps -ef | grep oracle question

Hi All, I have issued ps -ef | grep oracle command and i got these result oracle 356394 1 0 09:32:06 - 0:03 oracleCMS (LOCAL=NO) Now I can see user from here but I can not from which machine they are running this process. How can I see that? Thanks, Vishal (5 Replies)
Discussion started by: vishalpatel03
5 Replies
Login or Register to Ask a Question