Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Invalid character error in Mybatis

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In mybatis I use select tag, the SQL is:

SELECT #{url} AS ID

and in the interface the url parameter's value is "#?ORG_ID='||ORG_ID"

then run it will occur a error cause:
 Invalid character.

I think is the character '#' or '?' caused?  but I need to use this.

How can I do it?

 
Greenhorn
Posts: 23
1
IBM DB2 Netbeans IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was thinking, maybe your sql statement is not correct.

Usually you would write something like this for an sql statement...

SELECT <SOME COLUMN NAME> AS ID WHERE ORG_ID = <SOME VALUE>

So for example...

SELECT DRIVER_LICENSE AS ID WHERE ORG_ID = COLORADO

Of course the database would have a DRIVER_LICENSE and ORG_ID columns.

Your sql, just by the looks of it seems to be off, I'm reading it as...

SELECT #?ORG_ID='||ORG_ID AS ID

This would indicate to me you have a column in your database named #?ORG_ID='||ORG_ID

Just some ideas, I could be way off.

 
xin yi
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Michael Billiot wrote:I was thinking, maybe your sql statement is not correct.

Usually you would write something like this for an sql statement...

SELECT <SOME COLUMN NAME> AS ID WHERE ORG_ID = <SOME VALUE>

So for example...

SELECT DRIVER_LICENSE AS ID WHERE ORG_ID = COLORADO

Of course the database would have a DRIVER_LICENSE and ORG_ID columns.

Your sql, just by the looks of it seems to be off, I'm reading it as...

SELECT #?ORG_ID='||ORG_ID AS ID

This would indicate to me you have a column in your database named #?ORG_ID='||ORG_ID
po
Just some ideas, I could be way off.



No, I just have a ORG_ID column in database, and it called string connect, use double tube character, the front string to connect ORG_ID column's value.  My English is very pool, you can understand, just ok~
 
Michael Billiot
Greenhorn
Posts: 23
1
IBM DB2 Netbeans IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you can show the code where you are having the problem that would be great.

Looking at your parameter value, I only see one single quote...

"#?ORG_ID='||ORG_ID"

Is this a typo? Seems like there should be two single quotes.

Sorry, I'm not very familiar with MyBatis so I might not be much help.
 
xin yi
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Michael Billiot wrote:

Sorry, I'm not very familiar with MyBatis so I might not be much help.



Is ok, thanks.
 
xin yi
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Michael Billiot wrote:



Do you have a FaceBook account? or WeChat?
 
Is this the real life? Is this just fantasy? Is this a tiny ad?
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic