Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

jsp jstl sql strange behaviour with as in mysql

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
In mysql i m having a stored procedure which has a sql like:


I m using a jstl code to get the values: -


But this code does not return anything but when the replace the above code ${rows.i_firstname} with ${rows.firstname} i get the correct values.

Anything wrong with jstl, is this replicable or my fault here...

Question also posted here: - http://stackoverflow.com/questions/4998749/jsp-jstl-sql-strange-behaviour-with-as-in-mysql

thanks
 
Ranch Hand
Posts: 544
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
You are selecting i_firstname as firstname(i.e. using aliases in SQL) and that is the reason why it works when you access "rows.firstname".
It is working as expected. Is there any other reason that you think it has strange behaviour?

regds,
Amit
 
Bartender
Posts: 1845
10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

amit punekar wrote:Hi,
You are selecting i_firstname as firstname(i.e. using aliases in SQL) and that is the reason why it works when you access "rows.firstname".
It is working as expected. Is there any other reason that you think it has strange behaviour?



I would suggest you take a closer look.
What I see is: select firstname as i_firstname

So it is coming back with the column name rather than the alias specified.
Of course that sql is embedded in a stored procedure in some fashion. I'm not entirely certain how a stored procedure is expected to return a result set.

What does the stored procedure you are using look like?
 
amit punekar
Ranch Hand
Posts: 544
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
Yeah that's right. Thanks for pointing this out.
Apologies for not reading the SQL properly..assumed that the query is correct...:-|

regards,
Amit
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic