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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

slightwv (䄆 Netminder) 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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
OP_ZaharinCommented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.