Solved

write sql by ExpressionBuilder

Posted on 2006-11-21
6
234 Views
Last Modified: 2010-03-31
hi experts,

     -I wanna perform a select task in toplink (an ORM framework of oracle) using ExpressionBuilder
              but i don't know how to write this sql statement in ExpressionBuilder syntax.  

  here is my sql syntax :
                                "select * from "Information" where ("LastName" || "MiddleName" || "FirstName") = 'MrJohnSmith' "

 please help me how to write this

 thanks so much
 lubuPhan


0
Comment
Question by:trkg
  • 3
  • 3
6 Comments
 
LVL 23

Expert Comment

by:Ajay-Singh
Comment Utility
try this:



ExpressionBuilder builder = new ExpressionBuilder();
Expression expression = builder.get("LastName").equal("MrJohnSmith").or(builder.get("MiddleName").equal("MrJohnSmith")).or(builder.get("FirstName").equal("MrJohnSmith"));

Vector list = uow.readAllObjects(Information.class, expression);
0
 

Author Comment

by:trkg
Comment Utility
oh sorry sir !  

my Table         Information                  

         column                    LastName        MiddleName      FirstName  
row1                                     Mr                    John              Smith
row2                                    Mrs                  Jonh              Smith


my sql syntax
        "select * from "Information" where ("LastName" || "MiddleName" || "FirstName") = 'MrJohnSmith' "

and my result  is  row1

sry bc my english 's too bad....  

0
 
LVL 23

Expert Comment

by:Ajay-Singh
Comment Utility
In that case it would be


ExpressionBuilder builder = new ExpressionBuilder();
Expression expression = builder.get("LastName").equal("Mr").and(builder.get("MiddleName").equal("John")).and(builder.get("FirstName").equal("Smith"));

Vector list = uow.readAllObjects(Information.class, expression);
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

Author Comment

by:trkg
Comment Utility
ok , but i don't want to cut String MrJohnSmith  ,  i want to add 3 column  then equal that with String .

the same my sql.  i add 3 column   ("LastName" || "MiddleName" || "FirstName")   then  equal  with  "MrJohnSmith"

thanks sir very much about your answers.  
0
 
LVL 23

Accepted Solution

by:
Ajay-Singh earned 500 total points
Comment Utility
I believe both are same
0
 

Author Comment

by:trkg
Comment Utility
yes , i know both are same result , but i NEED to that in my way .

thanks very much
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now