bad precision specifier

i am trying to run the attached query but i keep getting an error of bad precision identifier, not sure how to correct it,please any one with a clue about this error help.

 
SELECT TITLE, URL
FROM
( SELECT TITLE, URL, SUM(VISITS) VISITS
FROM POWERHOUSEMOSTPOPULAR
WHERE LASTUPDATE>= TRUNC(SYSDATE,'mm')
AND LASTUPDATE<= SYSDATE
GROUP BY TITLE, URL
ORDER BY VISITS DESC)
WHERE ROWNUM <= 6)'. ORA-01899: bad precision specifier)

Open in new window

itortuAsked:
Who is Participating?
 
slightwv (䄆 Netminder)Connect With a Mentor Commented:
Did you by chance copy and paste this from a larger query?  You appear to have an extra closing paran.  The reason I ask, is nothing looks wrong with what you posted so the error might be elsewhere.

Not related to the specific error but why take the overhead to SUM visits then not select it?
0
 
OP_ZaharinConnect With a Mentor Commented:
hi itortu,
- have you got your query working now? basically the bad precision specifier error is related to date conversion.

- your sql seems ok except what have been mention by slightwv that you have extra closing bracket on this line >> WHERE ROWNUM <= 6)


- i've simulate your table assuming the column and dataype as follows:
CREATE TABLE powerhousemostpopular
    (title                           VARCHAR2(100),
    url                             VARCHAR2(100),
    visits                         NUMBER(5),
    lastupdate                 DATE)

- i've taken your query and run only the following section and return results is fine with no such bad precision error:

SELECT TITLE, URL, SUM(VISITS) VISITS
FROM POWERHOUSEMOSTPOPULAR
WHERE 
LASTUPDATE >= TRUNC(SYSDATE,'mm')
AND LASTUPDATE <= SYSDATE
GROUP BY TITLE, URL
ORDER BY VISITS DESC

Open in new window


0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.