Question

Asked on 2009-12-14 at 08:03:57ID: 25451604

SQL SIMPLE

by: Sara_j_11500

Rating8.2Very Good

My Sql:
SELECT ACCT_NBR, ALI_JOIN_DT, TO_CHAR(ALI_JOIN_DT, 'YYYYMM') -1
FROM ACCT
WHERE ACCT_NBR = 117

My result:
ACCT_NBR      ALI_JOIN_DT      TO_CHAR(ALI_JOIN_DT,'YYYYMM')-1      
117      12/10/2009 00:00:00      200911      
                  
NOW I WANT TO ADD ONE MORE COLUMN TO MY SQL , AS BELOW, so that I can find the month of year of 12 months before ali_join_dt                  
ACCT_NBR      ALI_JOIN_DT      TO_CHAR(ALI_JOIN_DT,'YYYYMM')-1      NEW column
117      12/10/2009 00:00:00      200911      200812

  1. datetime conversion to  YYYYMM
    I have a datetime field. How do I show the field in the format YYYYMM? For example here is what doesn't work: Select TRUNC(TRANSACTION_DTTM, 'YYYYMM') MYDATE FROM MyTable
  2. Compiling SQL Query
    Would like to compile this sql but I cannot remember how to compile...please help. TIA... create or replace view v_tcshft as select (C_TCSHS.SHIFT_CODE) C_TCSHFT_SHIFT_CODE, (C_TCSHS.DESCRIPTION) DESCRIPTION, (C_TCSHS.USEBONUSASPERCENT) USEBONASPERCENT, (C_TCSHS.OVERTIME_AF…
  3. formating decimal with to_char
    hi can someone help me understand how to convert this 1e-12 to 1 decimal digit? will it be 1.0e-12 even if i need to convert 1e-12 ==> 1.0e-12 how will i do .. i tried below: TMPVAL := to_char(1e-12,'99999999999.9'); which gives me .0 any help thanks
  4. Need a SQL Query
    A Party , B Number , Start Date (DD:MM:YYYY HH:MI:SS) , Duration. XXXXXXXX, YYYYYYYY , 10-06-2009 12:34:21 , 62 Sec. Need a process sql which can give the fields as below. A Party , B Number , Start Date and Time , End Date and Time. XXXXXXXX, YYYYYYYY , 10…
  5. SQL Query to get duplicate entries
    Hi all, I currently have the following SQL query... SELECT TO_CHAR(EVLOG.CREATEDATE, 'dd-mm-yyyy hh24:mi:ss') as DateTime, EVLOG.CUSTOMERID, EVLOG.ORGNR, EVLOG.SERVICEID, EVLOG.IPADDRESS, EVLOG.DESCRIPTION FROM CS_COMMON.CS_CUSTOMER_LOG …

Solution

Sign up now to view this solution! It's quick, easy, and secure to subscribe. We will return you to this solution, unlocked, when you’re done.

About this Solution
View This Solution - Start Your 30 Day Free Trial
Zone
General
Tags
Participating Experts
1
Solution Grade
A

Replies

 by: flow01

Posted on 2009-12-14 at 09:39:15ID: 28192556

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by:

Posted on 2009-12-14 at 09:49:16ID: 28192557

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

Stay Connected

Oracle Around the Web

The latest Oracle news, tips, and tricks

Oracle Unveils Netra SPARC T3 Servers

New Carrier-Grade Blade and Rackmount Servers Deliver Better Performance, Density and Power Efficiency for the Communications Industry ...

read more

Oracle fixes 21 flaws in Java SE, Java for Business

Oracle is fixing 21 flaws in its Java SE and Java for Business products in its February critical patch update issued this week ...

read more

Obama’s Silicon Valley “Tech Supper”

Why was he there? Who wasn’t invited and why? What did they talk about? Why was he really there? These are the questions being debated ...

read more

Featured Oracle Experts

slightwv

slightwv has answered more than 2,000 Oracle questions and oversees database management within the U.S. Government. Slightwv

sdstuber

A regular presenter at the Collaborate conference, Oracle developer sdstuber is a top expert in PL/SQL and Oracle 9, 10 and 11. sdstuber

Testimonials

What users are saying about our experts

"The Oracle gurus provide answers, solutions and valuable workarounds"

User: schwertner

"Wow! Excellent, valuable explanation. Hats off to you"

User: aseshu70

"Solution worked fantastic and performs excellent! Thanks heaps"

User: klausbrandlhuber

Top Experts

  1. slightwv

    2,000

    0 points yesterday

    Profile

BrowseBecome an Expert