pdl_babu has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: Perl DBI Error
by rnahi (Curate) on Nov 22, 2005 at 09:30 UTC
Re: Perl DBI Error
by castaway (Parson) on Nov 22, 2005 at 09:38 UTC
    If you think this is a Perl/DBI error, then please add the Perl code that produced the error, and not just the query. Was it concatted together? Did you use bind params? We can't tell.

    The error as it stands, thinks it cant see/read a file called p.frm in your prod database, since that should be an alias for projectedvolume, I would guess that your query in the perl code is not what you think it is.

    C.

Re: Perl DBI Error
by davorg (Chancellor) on Nov 22, 2005 at 09:24 UTC

    It looks like there might be a problem with your query as that error message would seem to imply that mysql is looking for a table called 'P'. It's difficuly to be sure tho' as your query is pretty badly formatted. Is there any chance you could tidy it up.

    Your first approach should be to eliminate Perl and DBI as sources of the the problem. You can do this by seeing if the query works from the mysql command line application. You say that you have had problems doing that, but the mysql program should easily handle queries much longer than yours.

    I think you need to take this to a mysql mailing list or forum in order to find out whether or not this is a mysql syntax problem. If you find that your query works without problems from mysql command line app, then come back here and we'll see if we can work out what DBD::mysql is doing wrong.

    Update: Another important piece of information that you omit is to tell us the version of MySQL that you are are using. I seem to remember that MySQL's support of the "left join on" syntax was a bit problematic in versions before 4.x.

    --
    <http://dave.org.uk>

    "The first rule of Perl club is you do not talk about Perl club."
    -- Chip Salzenberg

Re: Perl DBI Error
by arunvelusamy (Monk) on Nov 22, 2005 at 09:32 UTC

    This error mesage show that the file "p.frm" (which contains your mysql table) is not there. There is a possibility that you have renamed any of the mysql folders. I encountered same error when i ran two versions of mysql in my pc (manually renamed the mysql folder).

    Regarding your second question, i dont know about the maximum length for a query but the copy buffer allowed is smaller than that your mysql query.

    ------------

    ArunVelusamy
    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: Perl DBI Error
by xorl (Deacon) on Nov 22, 2005 at 13:09 UTC
    Try this:
    select left(B.B_num,3) as JD, sum(B.B_COUNT) as Doc_Cnt, P.PROJECTED_VOL as Proj_Vol, P.DD_RECD as DD_Recd, P.JD_CURRENT as JD_Current, P.JD_FUTURE as JD_Future from batches as B left join projectedvolume as P on (P.REPORT_IMPORT_DT = B.REPORT_IMPORT_DT) where B.REPORT_IMPORT_DT = '2005-10-12' group by left(b_num,3)

    I don't know if this will work, but I'm pretty sure you have to have "as" to tell it you want to refer to the batches table as B and the projectedvolumn as P. The On clause generally should be enclosed in () although I'm not sure that is a requirement.