views:

51

answers:

1

Hi Everybody,

I am using IBM-Informix for my school project as part of "Informix on-campus" ativity conduted by IBM.

however it is giving me error as "(USE31) - Too few points for geometry type in ST_LineFromText.", in the second linefromtext function.

A: 

The problem in the second call to ST_LineFromText() is that you are attempting to pass parameters into it, which isn't possible. You have:

ST_LineFromText('linestring (0 0,v1.pre 0,v1.pre v1.post,0 v1.post,0 0 )',5)

The string contains 'v1.pre' which is not a valid number, etc. If you need to parameterize your query, you either need to generate the string with those values in place, or you need to use a different method. One crude but possible solution is:

ST_LineFromText('linestring (0 0,' || v1.pre || ' 0,' || v1.pre || ' ' ||
                v1.post || ',0 ' || v1.post || ',0 0 )', 5)

This may not do the job - but illustrates the problem.

Jonathan Leffler
Thanks a lot Mr. Leffler, for your answer. Thanks for formatting my question, being new to this site, I was completely unaware of the formatting. I am really sorry for your inconvenience. Yes, I get that the problem is in parameters of the linestring function. As you said, here my requirement is to parametrize linestring function or in any other way construct polygon from parameters. I can't pass the fixed parameters. If I change those v1.pre and v1.post in linestring function to some integer values, it is working very fine.
swatit
[Continued..]But I can't always do that. My linestring functions parameters are decided at runtime. Can you please guide me how can we construct polygon when the co-ordiantes of the polygon are based on the result of the earlier part of the same query. Or simply we can't do it i.e polygon requires fixed set of co-ordinates?I tried the query suggested by you, but it is not working.I hope my question is clear.I appreciate all your help and guidance!
swatit