Error: Compiled code for this line too long. ?? 
Author Message
 Error: Compiled code for this line too long. ??

I have a long SQL statement; see below:

SELECT A.FOOD_ID AS 'ID', A.AMOUNT AS 'HHQTY', A.UNIT AS 'HHMEAS', A.GRAMS
AS
'HHGM', ;
B.DENSITY, B.NAME, ;
B.FATX*(A.GRAMS/B.HHGM) AS 'FATX', ;
B.BRDX*(A.GRAMS/B.HHGM) AS 'BRDX', ;
B.FRTX*(A.GRAMS/B.HHGM) AS 'FRTX', ;
B.METX*(A.GRAMS/B.HHGM) AS 'METX', ;
B.VEGX*(A.GRAMS/B.HHGM) AS 'VEGX', ;
B.MLKX*(A.GRAMS/B.HHGM) AS 'MLKX', ;
B.PROT*(A.GRAMS/B.HHGM) AS 'PROT', ;
B.FAT*(A.GRAMS/B.HHGM) AS 'FAT', ;
B.CARB*(A.GRAMS/B.HHGM) AS 'CARB', ;
B.ALCH*(A.GRAMS/B.HHGM) AS 'ALCH', ;
B.H2O*(A.GRAMS/B.HHGM) AS 'H2O', ;
B.CAFF*(A.GRAMS/B.HHGM) AS 'CAFF', ;
B.INSFIBR*(A.GRAMS/B.HHGM) AS 'INSFIBR', ;
B.FIBR*(A.GRAMS/B.HHGM) AS 'FIBR', ;
B.CHOL*(A.GRAMS/B.HHGM) AS 'CHOL', ;
B.SATFAT*(A.GRAMS/B.HHGM) AS 'SATFAT', ;
B.MONOFAT*(A.GRAMS/B.HHGM) AS 'MONOFAT', ;
B.POLYFAT*(A.GRAMS/B.HHGM) AS 'POLYFAT', ;
B.VITD*(A.GRAMS/B.HHGM) AS 'VITD', ;
B.VITK*(A.GRAMS/B.HHGM) AS 'VITK', ;
B.VITE*(A.GRAMS/B.HHGM) AS 'VITE', ;
B.VITA*(A.GRAMS/B.HHGM) AS 'VITA', ;
B.VITC*(A.GRAMS/B.HHGM) AS 'VITC', ;
B.THI*(A.GRAMS/B.HHGM) AS 'THI', ;
B.RIB*(A.GRAMS/B.HHGM) AS 'RIB', ;
B.NIA*(A.GRAMS/B.HHGM) AS 'NIA', ;
B.PANT*(A.GRAMS/B.HHGM) AS 'PANT', ;
B.VITB6*(A.GRAMS/B.HHGM) AS 'VITB6', ;
B.FOL*(A.GRAMS/B.HHGM) AS 'FOL', ;
B.VITB12*(A.GRAMS/B.HHGM) AS 'VITB12', ;
B.CAL*(A.GRAMS/B.HHGM) AS 'CAL', ;
B.IRON*(A.GRAMS/B.HHGM) AS 'IRON', ;
B.MAG*(A.GRAMS/B.HHGM) AS 'MAG', ;
B.PHO*(A.GRAMS/B.HHGM) AS 'PHO', ;
B.POT*(A.GRAMS/B.HHGM) AS 'POT', ;
B.SOD*(A.GRAMS/B.HHGM) AS 'SOD', ;
B.ZINC*(A.GRAMS/B.HHGM) AS 'ZINC', ;
B.COPP*(A.GRAMS/B.HHGM) AS 'COPP', ;
B.MAN*(A.GRAMS/B.HHGM) AS 'MAN';
FROM INTAKES A, FOODS B ;
WHERE A.PERSON_ID = nPersonID ;
AND A.DAYNUM = nDay ;
AND A.MEAL = strMeal ;
AND A.FOOD_ID = nFoodID ;
AND B.ID = A.FOOD_ID ;
INTO CURSOR (strCursor)

When I try to compile I get "Compiled code for this line too long."  The
manual
tells me to break up the statement.  I don't know how to.  Any
suggestions?
I realize that I could break it into 3 statements/cursors but this is less
than
desirable.  Thanks in advance.

Tracy Dalzell
GUI Solutions, Inc.
1000 W. University
Suite 100
Rochester, MI  48307
Voice: 810.650.2206  
Fax 810.650.3106



Fri, 05 Dec 1997 03:00:00 GMT  
 Error: Compiled code for this line too long. ??

Quote:

>I have a long SQL statement; see below:

>SELECT A.FOOD_ID AS 'ID', A.AMOUNT AS 'HHQTY', A.UNIT AS 'HHMEAS', A.GRAMS
>AS
>'HHGM', ;
>B.DENSITY, B.NAME, ;
>B.FATX*(A.GRAMS/B.HHGM) AS 'FATX', ;
>B.BRDX*(A.GRAMS/B.HHGM) AS 'BRDX', ;
>B.FRTX*(A.GRAMS/B.HHGM) AS 'FRTX', ;
>B.METX*(A.GRAMS/B.HHGM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 'MAG', ;
>B.PHO*(A.GRAMS/B.HHGM) AS 'PHO', ;
>B.POT*(A.GRAMS/B.HHGM) AS 'POT', ;
>B.SOD*(A.GRAMS/B.HHGM) AS 'SOD', ;
>B.ZINC*(A.GRAMS/B.HHGM) AS 'ZINC', ;
>B.COPP*(A.GRAMS/B.HHGM) AS 'COPP', ;
>B.MAN*(A.GRAMS/B.HHGM) AS 'MAN';
>FROM INTAKES A, FOODS B ;
>WHERE A.PERSON_ID = nPersonID ;
>AND A.DAYNUM = nDay ;
>AND A.MEAL = strMeal ;
>AND A.FOOD_ID = nFoodID ;
>AND B.ID = A.FOOD_ID ;
>INTO CURSOR (strCursor)

>When I try to compile I get "Compiled code for this line too long."  The
>manual
>tells me to break up the statement.  I don't know how to.  Any
>suggestions?
>I realize that I could break it into 3 statements/cursors but this is less
>than
>desirable.  Thanks in advance.

>Tracy Dalzell
>GUI Solutions, Inc.
>1000 W. University
>Suite 100
>Rochester, MI  48307
>Voice: 810.650.2206  
>Fax 810.650.3106


My solution is probably slow, but I always use the & when my code gets to
large.  

ex)

fld1= "B.FATX*(A.GRAMS/B.HHGM)"

select &fld1 as fatx



Sat, 06 Dec 1997 03:00:00 GMT  
 Error: Compiled code for this line too long. ??

Quote:

>I have a long SQL statement; see below:
>SELECT A.FOOD_ID AS 'ID', A.AMOUNT AS 'HHQTY', A.UNIT AS 'HHMEAS', A.GRAMS
>AS
>'HHGM', ;
>B.DENSITY, B.NAME, ;
>B.FATX*(A.GRAMS/B.HHGM) AS 'FATX', ;

  < lots more calculated fields >

Quote:
>FROM INTAKES A, FOODS B ;
>WHERE A.PERSON_ID = nPersonID ;
>AND A.DAYNUM = nDay ;
>AND A.MEAL = strMeal ;
>AND A.FOOD_ID = nFoodID ;
>AND B.ID = A.FOOD_ID ;
>INTO CURSOR (strCursor)
>When I try to compile I get "Compiled code for this line too long."  The
>manual
>tells me to break up the statement.  I don't know how to.  Any
>suggestions?
>I realize that I could break it into 3 statements/cursors but this is less
>than
>desirable.  Thanks in advance.

This of course is a limitation in FoxPro and not a limitation in SQL.
Therefore, whether it is desireable or not, you have to find a kludge
to make it work, and you'll have to experiment.  One suggestion is to
first do the join between the two databases and then do the
calculation of the new fields:

SELECT A.*, B.*;
  FROM INTAKES A, FOODS B ;
  WHERE A.PERSON_ID = nPersonID ;
  AND A.DAYNUM = nDay ;
  AND A.MEAL = strMeal ;
  AND A.FOOD_ID = nFoodID ;
  AND B.ID = A.FOOD_ID ;
  INTO CURSOR Meal

SELECT MEAL.FOOD_ID AS ID, MEAL.AMOUNT AS HHQTY,;
 MEAL.UNIT AS HHMEAS, MEAL.GRAMS AS HHGM, ;
 MEAL.DENSITY, MEAL.NAME, ;
 MEAL.FATX*(MEAL.GRAMS/MEAL.HHGM) AS FATX, ;
  < lots more calculated fields >
 FROM Meal
 INTO CURSOR (strCursor)

(BTW, I see you have " SELECT OLD as 'NEW' "; I assume you know that
NEW should not have quotes around it).

If the second SELECT is still too big, what I would probably do is
CREATE CURSOR (strCursor) and define all the fields you want there and
then write a SCAN loop to run through MEAL (the result of my first
SELECT) APPENDING records to (strCursor) and filling the fields with
the necessary information from MEAL.  I know I have had to resort to
that approach in my own work.

  /***************************************************************



  ***************************************************************/



Sat, 06 Dec 1997 03:00:00 GMT  
 Error: Compiled code for this line too long. ??

* I have a long SQL statement; see below:
*
* SELECT A.FOOD_ID AS 'ID', A.AMOUNT AS 'HHQTY', A.UNIT AS 'HHMEAS', A.GRAMS
* AS
* 'HHGM', ;
* B.DENSITY, B.NAME, ;
* B.FATX*(A.GRAMS/B.HHGM) AS 'FATX', ;
* B.BRDX*(A.GRAMS/B.HHGM) AS 'BRDX', ;
* B.FRTX*(A.GRAMS/B.HHGM) AS 'FRTX', ;
* B.METX*(A.GRAMS/B.HHGM) AS 'METX', ;
* B.VEGX*(A.GRAMS/B.HHGM) AS 'VEGX', ;
* B.MLKX*(A.GRAMS/B.HHGM) AS 'MLKX', ;
* B.PROT*(A.GRAMS/B.HHGM) AS 'PROT', ;
* B.FAT*(A.GRAMS/B.HHGM) AS 'FAT', ;
* B.CARB*(A.GRAMS/B.HHGM) AS 'CARB', ;
* B.ALCH*(A.GRAMS/B.HHGM) AS 'ALCH', ;
* B.H2O*(A.GRAMS/B.HHGM) AS 'H2O', ;
* B.CAFF*(A.GRAMS/B.HHGM) AS 'CAFF', ;
* B.INSFIBR*(A.GRAMS/B.HHGM) AS 'INSFIBR', ;
* B.FIBR*(A.GRAMS/B.HHGM) AS 'FIBR', ;
* B.CHOL*(A.GRAMS/B.HHGM) AS 'CHOL', ;
* B.SATFAT*(A.GRAMS/B.HHGM) AS 'SATFAT', ;
* B.MONOFAT*(A.GRAMS/B.HHGM) AS 'MONOFAT', ;
* B.POLYFAT*(A.GRAMS/B.HHGM) AS 'POLYFAT', ;
* B.VITD*(A.GRAMS/B.HHGM) AS 'VITD', ;
* B.VITK*(A.GRAMS/B.HHGM) AS 'VITK', ;
* B.VITE*(A.GRAMS/B.HHGM) AS 'VITE', ;
* B.VITA*(A.GRAMS/B.HHGM) AS 'VITA', ;
* B.VITC*(A.GRAMS/B.HHGM) AS 'VITC', ;
* B.THI*(A.GRAMS/B.HHGM) AS 'THI', ;
* B.RIB*(A.GRAMS/B.HHGM) AS 'RIB', ;
* B.NIA*(A.GRAMS/B.HHGM) AS 'NIA', ;
* B.PANT*(A.GRAMS/B.HHGM) AS 'PANT', ;
* B.VITB6*(A.GRAMS/B.HHGM) AS 'VITB6', ;
* B.FOL*(A.GRAMS/B.HHGM) AS 'FOL', ;
* B.VITB12*(A.GRAMS/B.HHGM) AS 'VITB12', ;
* B.CAL*(A.GRAMS/B.HHGM) AS 'CAL', ;
* B.IRON*(A.GRAMS/B.HHGM) AS 'IRON', ;
* B.MAG*(A.GRAMS/B.HHGM) AS 'MAG', ;
* B.PHO*(A.GRAMS/B.HHGM) AS 'PHO', ;
* B.POT*(A.GRAMS/B.HHGM) AS 'POT', ;
* B.SOD*(A.GRAMS/B.HHGM) AS 'SOD', ;
* B.ZINC*(A.GRAMS/B.HHGM) AS 'ZINC', ;
* B.COPP*(A.GRAMS/B.HHGM) AS 'COPP', ;
* B.MAN*(A.GRAMS/B.HHGM) AS 'MAN';
* FROM INTAKES A, FOODS B ;
* WHERE A.PERSON_ID = nPersonID ;
* AND A.DAYNUM = nDay ;
* AND A.MEAL = strMeal ;
* AND A.FOOD_ID = nFoodID ;
* AND B.ID = A.FOOD_ID ;
* INTO CURSOR (strCursor)
*
* When I try to compile I get "Compiled code for this line too long."  The
* manual
* tells me to break up the statement.  I don't know how to.  Any
* suggestions?
* I realize that I could break it into 3 statements/cursors but this is less
* than
* desirable.  Thanks in advance.
*
* Tracy Dalzell
* GUI Solutions, Inc.
* 1000 W. University
* Suite 100
* Rochester, MI  48307
* Voice: 810.650.2206  
* Fax 810.650.3106

Well the correct way would be to split you selects using the Union clause,
see the manual for details, also you can remove the unnecessary quotes in
the lines:

Instead of: B.FATX*(A.GRAMS/B.HHGM) AS 'FATX', ;

use this: B.FATX*(A.GRAMS/B.HHGM) AS FATX, ;

That will save 78 characters in your code, though it is still too long.

--
Cheers,
Ian E Pidgeon
Split Second Timing
Sydney, Australia



Tue, 09 Dec 1997 03:00:00 GMT  
 Error: Compiled code for this line too long. ??


Quote:



>* I have a long SQL statement; see below:

< snip >

why don't you try this...

data1 = 'a.food_id as ID, a.amount as hhqty, a.unit as hhmeas, '
data2 = 'a.grams as hhgm, ......

followed by a...

select &data1 &data2 &data3 ....
  FROM INTAKES A, FOODS B ;
  WHERE A.PERSON_ID = nPersonID ;
  AND A.DAYNUM = nDay ;
  AND A.MEAL = strMeal ;
  AND A.FOOD_ID = nFoodID ;
  AND B.ID = A.FOOD_ID ;
  INTO CURSOR (strCursor)

---------
Kobi Ofir      CompSci & Stats


all."

.eof



Sun, 14 Dec 1997 03:00:00 GMT  
 Error: Compiled code for this line too long. ??
Concerning a long SQL Select statement which generated the error
"Compiled code too long":

Quote:

>data1 = 'a.food_id as ID, a.amount as hhqty, a.unit as hhmeas, '
>data2 = 'a.grams as hhgm, ......
>followed by a...
>select &data1 &data2 &data3 ....
>  FROM INTAKES A, FOODS B ;
>  WHERE A.PERSON_ID = nPersonID ;
>  AND A.DAYNUM = nDay ;
>  AND A.MEAL = strMeal ;
>  AND A.FOOD_ID = nFoodID ;
>  AND B.ID = A.FOOD_ID ;
>  INTO CURSOR (strCursor)

Since the error was "Compiled code too long", I don't think that this
approach, which was previously suggested by someone else, will work.
Hiding some of the statement in a macro should have no effect
whatsoever on the compiled code (it seems to me).
  /***************************************************************



  ***************************************************************/


Mon, 15 Dec 1997 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. FPW26 Compiled code for this line too long

2. Compiled Line Too Long????

3. Compile code too long

4. Error "Compiled code for these line to long (1252)" with FPW 2.6

5. Line is too long (error 18)

6. program error - line too long

7. "Line too long to fit" Error

8. SQL line too long error

9. Line too long for Compiler!

10. Q: "LINE TOO LONG"

11. Need Help on compiling FoxPro from the Command Line

12. Table update Problem - "line too long"

 

 
Powered by phpBB® Forum Software