Mysterious where clause with japanese
enviroment:
PL/SQL Develope, Version 7.1.0.1337, Windows XP Professional 5.1 Build 2600 (Service Pack 2)
Here is the problem, when i add a where clause with japanese, the data evaporated:
SQL> select * from ja_test;
EXECUTABLE_NAME DESCRIPTION
XX00MRP0411C 需要供給データ作成マネージャ
SQL> select * from ja_test j where j.description = '需要供給データ作成マネージャ';
EXECUTABLE_NAME DESCRIPTION
SQL>
thanks in advance!
Thanks for replies and Sorry for my rashness, maybe the following
scripts could explain the problem more well. I create a table named
ja_test with two fields(EXECUTABLE_NAME and DESCRIPTION), both of the
type is varchar2, and there is only one record in the table,
but the DESCRIPTION contains JAPANESE characters, when i use a where
clause like this "where j.executable_name = 'XX00MRP0411C';", everything
seems work fine, but when the where clase include JAPANESE characters
like this "j.description = '需要供給データ作成マネージャ';", even if
the "j.description" is copied form database, no records returned:
SQL> select * from ja_test j where j.executable_name = 'XX00MRP0411C';
EXECUTABLE_NAME DESCRIPTION
XX00MRP0411C 需要供給データ作成マネージャ
SQL> select * from ja_test j where j.description = '需要供給データ作成マネージャ';
EXECUTABLE_NAME DESCRIPTION
SQL> desc ja_test;
Name Type Nullable Default Comments
EXECUTABLE_NAME VARCHAR2(30)
DESCRIPTION VARCHAR2(240) Y
SQL>
Similar Messages
-
How can I pass multiple condition in where clause with the join table?
Hi:
I need to collect several inputs at run time, and query the record according to the input.
How can I pass multiple conditions in where clause with the join table?
Thanks in advance for any help.
Regards,
TDIf you are using SQL-Plus or Reports you can use lexical parameters like:
SELECT * FROM emp &condition;
When you run the query it will ask for value of condition and you can enter what every you want. Here is a really fun query:
SELECT &columns FROM &tables &condition;
But if you are using Forms. Then you have to change the condition by SET_BLOCK_PROPERTY.
Best of luck! -
Hii,
I have an issue with using where clause with time stamp. My requirement is to
select * from driver_on_policy
where last_change_datetime = '2001-03-06 19:00:06'
date is in this form 6/3/2001 7:00:06 PM
thnks
samIf you want to use '6/3/2001 7:00:06 PM', then
where last_change_datetime = to_timestamp('6/3/2001 7:00:06 PM','DD/MM/YYYY HH:MI:SS PM')If you can use a literal string in ANSI standard YYYY-MM-DD HH24:MI:SS format, then just
where last_change_datetime = timestamp '2001-03-06 19:00:06' (That 'DD/MM' might need to be switched around to 'MM/DD' if you are in America.)
Message was edited by:
William Robertson -
SQL query in SQL_REDO Logminor showing where clause with ROWID
SQL query in SQL_REDO Logminor showing where clause with ROWID. I dont wanted to use rowid but wanted to use actual value.
OPERATION SQL_REDO SQL_UNDO
DELETE delete from "OE"."ORDERS" insert into "OE"."ORDERS"
where "ORDER_ID" = '2413' ("ORDER_ID","ORDER_MODE",
and "ORDER_MODE" = 'direct' "CUSTOMER_ID","ORDER_STATUS",
and "CUSTOMER_ID" = '101' "ORDER_TOTAL","SALES_REP_ID",
and "ORDER_STATUS" = '5' "PROMOTION_ID")
and "ORDER_TOTAL" = '48552' values ('2413','direct','101',
and "SALES_REP_ID" = '161' '5','48552','161',NULL);
and "PROMOTION_ID" IS NULL
and ROWID = 'AAAHTCAABAAAZAPAAN';
DELETE delete from "OE"."ORDERS" insert into "OE"."ORDERS"
where "ORDER_ID" = '2430' ("ORDER_ID","ORDER_MODE",
and "ORDER_MODE" = 'direct' "CUSTOMER_ID","ORDER_STATUS",
and "CUSTOMER_ID" = '101' "ORDER_TOTAL","SALES_REP_ID",
and "ORDER_STATUS" = '8' "PROMOTION_ID")
and "ORDER_TOTAL" = '29669.9' values('2430','direct','101',
and "SALES_REP_ID" = '159' '8','29669.9','159',NULL);
and "PROMOTION_ID" IS NULL
and ROWID = 'AAAHTCAABAAAZAPAAe';
Please let me know solution/document which will convert SQL redo rowid value with actual value.
Thanks,Please enclose your output within tag so that people here can read it easily and help you. Also the reason that why you want to remove rowid?
Salman
Edited by: Salman Qureshi on Mar 20, 2013 3:53 PM -
Where clause with a combination of And and Or statements - Basic question
Hi,
I have a where clause with a combination of And and Or statements... May I know which one would run first
Here is the sample
WHERE SITE_NAME = 'Q' AND ET_NAME IN ('12', '15') AND TEST_DATE > DATE OR SITE_NAME = 'E' AND ET_NAME IN ('19', '20')
can you please explain how this combination works
Thanks in advanceHi,
This reminds me of a great story. It's so good, it probably didn't really happen, but it's so good, I'm going to repeat it anyway.
IBM once had an "executive apptitude test" that they would give to job applicants. There were some questions you might call general knowlege or trivia questions, and each question had a weight (for example, answering an unimportant queestion might score one point, an important question might be 5 points.) One of the questions was "What is the standard width of a mobile home?", and the weight of the question was -20: answering the question correctly did serious harm to your score. The reasoning was that the more you knew about mobile homes, the less likely you were to be their kind of executive.
Now, as to your question, the correct answer is: I don't know. I don't want to know. Mixing ANDs and ORs without grouping them in parentheses is a really bad idea. Even if you get it right, it's going to confuse the next person who has to look at that code. Use parentheses to make sure the code is doing what you want it to do.
If you really want to find out, it's documented in the SQL language manual. Look up "Operators, prcedence"
http://docs.oracle.com/cd/E11882_01/server.112/e26088/operators001.htm#sthref815
You can easily do an experiment, using scott.emp, or even dual, where
WHERE (x AND y)
OR zproduces different results from
WHERE x
AND (y OR z) -
Generate a where clause with outer join criteria condition: (+)=
Hi,
In my search page, I use Auto Customization Criteria mode, and I build where clause by using get Criteria():
public void initSrpQuery(Dictionary[] dic, String userName) {
int dicSize = dic.length;
StringBuffer whereClause = new StringBuffer(100);
Vector parameters = new Vector(5);
int clauseCount = 0;
int bindCount = 1;
for(int i=0; i < dicSize; i++){
String itemName = (String)(dic.get(OAViewObject.CRITERIA_ITEM_NAME));
Object value = dic[i].get(OAViewObject.CRITERIA_VALUE);
String joinCondition = (String)dic[i].get(OAViewObject.CRITERIA_JOIN_CONDITION);
String criteriaCondition = (String)dic[i].get(OAViewObject.CRITERIA_CONDITION);
String criteriaDataType = (String)dic[i].get(OAViewObject.CRITERIA_DATATYPE);
String viewAttributename = (String)dic[i].get(OAViewObject.CRITERIA_VIEW_ATTRIBUTE_NAME);
String columnName = findAttributeDef(viewAttributename).getColumnNameForQuery();
if((value != null) /*&& (!("".equals((String).trim())))*/){
if(clauseCount > 0){
whereClause.append(" AND ");
whereClause.append(columnName + " " + criteriaCondition + " :");
whereClause.append(++bindCount);
parameters.addElement(value);
clauseCount++;
If I want to generate following where clause:
select
,emp.name
,emp.email
,emp.salesrep_number
,comp.name
,gs.srp_goal_header_id
,gs.status_code
,gs.start_date
,gs.end_date
from g2c_goal_shr_emp_assignments_v emp
,jtf_rs_salesreps rs
,xxg2c_srp_goal_headers_all gs
,cn_comp_plans_all comp
where 1 = 1
and rs.salesrep_id = gs.salesrep_id (+)
and gs.comp_plan_id = comp.comp_plan_id (+)
and gs.period_year (+) = :1 -- :1 p_fiscal_year
How can I generate a where clause with outer join : gs.period_year (+) = :1 ? Will I get '(+)=' from get(OAViewObject.CRITERIA_CONDITION)?
thanks
LeiIf you are using SQL-Plus or Reports you can use lexical parameters like:
SELECT * FROM emp &condition;
When you run the query it will ask for value of condition and you can enter what every you want. Here is a really fun query:
SELECT &columns FROM &tables &condition;
But if you are using Forms. Then you have to change the condition by SET_BLOCK_PROPERTY.
Best of luck! -
Dynamic where clause with loop statement
Hi all,
is it possible to use a dynamic where clause with a loop statement?
Can you please advise me, how the syntax needs to be?
Thanks for your suggestions,
kind regards, Kathrin!Hi Kathrin,
If u are in ECC 6.0, please go through the code...
REPORT zdynamic_select.
TYPES:
BEGIN OF ty_sales,
vbeln TYPE vbak-vbeln, " Sales document
posnr TYPE vbap-posnr, " Sales document item
matnr TYPE vbap-matnr, " Material number
arktx TYPE vbap-arktx, " Short text for sales order item
kwmeng TYPE vbap-kwmeng, " Order quantity
vkorg TYPE vbak-vkorg, " Sales organization
kunnr TYPE vbak-kunnr, " Sold-to party
netwr TYPE vbak-netwr, " Net Value of the Sales Order
END OF ty_sales.
DATA :
gt_sales TYPE STANDARD TABLE OF ty_sales,
wa_sales TYPE ty_sales.
DATA: ob_select TYPE REF TO cl_rs_where.
DATA: ob_from TYPE REF TO cl_rs_where.
DATA: ob_where TYPE REF TO cl_rs_where,
gv_source TYPE abapsource.
START-OF-SELECTION.
*Step 1 : Prepare the select fields.
PERFORM zf_build_select.
*Step 2 : Build the from clause for the select
PERFORM zf_build_from.
*Step 3 : Build the where clause for the select
PERFORM zf_build_where.
*Step 4 : Execute the dynamic select
SELECT (ob_select->n_t_where)
FROM (ob_from->n_t_where)
INTO CORRESPONDING FIELDS OF TABLE gt_sales
WHERE (ob_where->n_t_where).
LOOP AT gt_sales INTO wa_sales.
WRITE : /5 wa_sales-vbeln,
15 wa_sales-vkorg,
20 wa_sales-kunnr,
40 wa_sales-netwr,
50 wa_sales-posnr,
60 wa_sales-matnr,
70 wa_sales-arktx,
90 wa_sales-kwmeng.
ENDLOOP.
*& Form zf_build_select
FORM zf_build_select .
CREATE OBJECT ob_select.
*Build the table name/field name combination
*Add Sales order header fields
CLEAR gv_source.
CALL METHOD cl_rs_where=>build_tabname_fieldname
EXPORTING
i_tabname = 'VBAK'
i_fieldname = 'VBELN'
i_sign = '~'
IMPORTING
e_combined = gv_source.
*Add the where line
CALL METHOD ob_select->add_line
EXPORTING
i_line = gv_source.
CLEAR gv_source.
CALL METHOD cl_rs_where=>build_tabname_fieldname
EXPORTING
i_tabname = 'VBAK'
i_fieldname = 'VKORG'
i_sign = '~'
IMPORTING
e_combined = gv_source.
*Add the where line
CALL METHOD ob_select->add_line
EXPORTING
i_line = gv_source.
CLEAR gv_source.
CALL METHOD cl_rs_where=>build_tabname_fieldname
EXPORTING
i_tabname = 'VBAK'
i_fieldname = 'KUNNR'
i_sign = '~'
IMPORTING
e_combined = gv_source.
*Add the where line
CALL METHOD ob_select->add_line
EXPORTING
i_line = gv_source.
CLEAR gv_source.
CALL METHOD cl_rs_where=>build_tabname_fieldname
EXPORTING
i_tabname = 'VBAK'
i_fieldname = 'NETWR'
i_sign = '~'
IMPORTING
e_combined = gv_source.
*Add the where line
CALL METHOD ob_select->add_line
EXPORTING
i_line = gv_source.
*Add Sales order item fields
CALL METHOD cl_rs_where=>build_tabname_fieldname
EXPORTING
i_tabname = 'VBAP'
i_fieldname = 'POSNR'
i_sign = '~'
IMPORTING
e_combined = gv_source.
*Add the where line
CALL METHOD ob_select->add_line
EXPORTING
i_line = gv_source.
CLEAR gv_source.
CALL METHOD cl_rs_where=>build_tabname_fieldname
EXPORTING
i_tabname = 'VBAP'
i_fieldname = 'MATNR'
i_sign = '~'
IMPORTING
e_combined = gv_source.
*Add the where line
CALL METHOD ob_select->add_line
EXPORTING
i_line = gv_source.
CLEAR gv_source.
CALL METHOD cl_rs_where=>build_tabname_fieldname
EXPORTING
i_tabname = 'VBAP'
i_fieldname = 'ARKTX'
i_sign = '~'
IMPORTING
e_combined = gv_source.
*Add the where line
CALL METHOD ob_select->add_line
EXPORTING
i_line = gv_source.
CLEAR gv_source.
CALL METHOD cl_rs_where=>build_tabname_fieldname
EXPORTING
i_tabname = 'VBAP'
i_fieldname = 'KWMENG'
i_sign = '~'
IMPORTING
e_combined = gv_source.
*Add the where line
CALL METHOD ob_select->add_line
EXPORTING
i_line = gv_source.
ENDFORM. " zf_build_select
*& Form zf_build_from
FORM zf_build_from .
CREATE OBJECT ob_from.
*Add opening bracket
CALL METHOD ob_from->add_opening_bracket
CLEAR gv_source.
*Add the join condition.This can be made
*fully dynamic as per your requirement
gv_source = 'VBAK AS VBAK INNER JOIN VBAP AS VBAP'.
*Add the where line
CALL METHOD ob_from->add_line
EXPORTING
i_line = gv_source.
CLEAR gv_source.
*Add the join condition.This can be made
*fully dynamic as per your requirement
gv_source = 'ON VBAKVBELN = VBAPVBELN'.
*Add the where line
CALL METHOD ob_from->add_line
EXPORTING
i_line = gv_source.
*Add the closing bracket
CALL METHOD ob_from->add_closing_bracket
ENDFORM. " zf_build_from
*& Form zf_build_where
FORM zf_build_where .
DATA :
lv_field TYPE REF TO data,
lv_field_low TYPE REF TO data,
lv_field_high TYPE REF TO data.
CREATE OBJECT ob_where.
*Add the field VBELN : Sales Document
*Use this method if you want to assign a single value to a field
*Set the value for VBELN : Sales Document Number
CALL METHOD ob_where->add_field
EXPORTING
i_fieldnm = 'VBAK~VBELN'
i_operator = '='
i_intlen = 10
i_datatp = 'CHAR'
IMPORTING
e_r_field = lv_field.
CALL METHOD ob_where->set_value_for_field
EXPORTING
i_fieldnm = 'VBAK~VBELN'
i_value = '0000120020'.
*Use this method if you want to assign a range of values
*Set a range for the Sales Document number
CALL METHOD ob_where->add_field_between_2values
EXPORTING
i_fieldnm = 'VBAK~VBELN'
i_intlen = 10
i_datatp = 'CHAR'
IMPORTING
e_r_field_low = lv_field_low
e_r_field_high = lv_field_high.
CALL METHOD ob_where->set_2values_for_field
EXPORTING
i_fieldnm = 'VBAK~VBELN'
i_value_low = '0000120020'
i_value_high = '0000120067'.
*Set the 'AND' Clause
CALL METHOD ob_where->add_and.
*Add the field MATNR : Material
CALL METHOD ob_where->add_field
EXPORTING
i_fieldnm = 'MATNR'
i_operator = '='
i_intlen = 18
i_datatp = 'CHAR'
IMPORTING
e_r_field = lv_field.
*Set the value for the Material field
CALL METHOD ob_where->set_value_for_field
EXPORTING
i_fieldnm = 'MATNR'
i_value = '000000000050111000'.
*Set the 'AND' Clause
CALL METHOD ob_where->add_and
*Add the field VKORG
CALL METHOD ob_where->add_field
EXPORTING
i_fieldnm = 'VKORG'
i_operator = '='
i_intlen = 4
i_datatp = 'CHAR'
IMPORTING
e_r_field = lv_field.
*Set the value for VKORG : Sales Organization
CALL METHOD ob_where->set_value_for_field
EXPORTING
i_fieldnm = 'VKORG'
i_value = 'GMUS'.
ENDFORM. " zf_build_where -
Where clause with Bind Variable in ViewObject
As per recomendations from Jdev team they say that using Bind varialbles in where clause will improve the performance (Option 1) But it is causing us to create more view objects.
Example : Lets say we have a View Object EmpVO
Option 1:
ViewObject vo=context.getViewObject("EmpVO");
vo.setWhereClause("EMPNO=?");
vo.setWhereClauseParam(0,st);
(or)
Option 2:
vo.setWhereClause("EMPNO="+st);
If we want to use same View Object "EmpVO" in another Action Class
ViewObject vo1=context.getViewObject("EmpVO");
vo1.setWhereClause("DEPTNO=?");
vo1.setWhereClauseParam(0,str);
It this case it throws an error saying BIND VARIABLE already exits. So we have to make another View Object.
Where as if we did not use bind variable but used Option 2 approach the same view object can be used in multiple pages.(at the expense of performance as per Jdev team)
Are we doing something wrong here or are there other ways to use the same view object when using bind variable in where clause.
ThanksI haven't been using BC4J for a while, but I seem to recall that the recommendations are that you don't set the where clause at runtime: You're supposed to define your view with the bind parameter already in it.
So you'd probably define an EmpsForEmpNoVO and type "EMPNO = ?" in the where box. (There are other ways of finding a single row/entity and one of those may well be more efficient. Perhaps a better example of where you might want a view of employees is WHERE DEPTNO = ?.)
IIRC, all instances of a particular type of view share the same definition, so you have to be careful if you alter that at runtime. However, I think everything's set up so that you can have many different (and separate) resultsets for a single view (instance) - meaning that it's possible to "run" a view for (e.g.) two different ids. (It's definitely possible to create two different instances of a view from its definition - and the resultsets will definitely be separate then. I think there's a "create" method on the application module; I remember that "find..." always returns the same instance of the view.)
Hope that's a push in the right direction (since no-one else had replied - and I hope not too much has changed since 9.0.3)....
Mike. -
Prob. with where clause with rownum
hi
i have a table with the following columns
SQL> desc mark
Name Null? Type
STUDENTCODE NUMBER(3)
MARK1 NUMBER(2)
MARK2 NUMBER(3)
and here are the rows in it
SQL> select * from mark ;
STUDENTCODE MARK1 MARK2
1 20 40
2 70 80
3 80 90
4 90 99
12 13 35
5 90 80
6 78 87
i wanna sum mark1 and mark2 and list down the rows with the top 2 rows
i tried to first list down all the rows in the order of sum with the following stat.
SQL> select studentcode,mark1+mark2 from mark order by mark1+mark2 desc
STUDENTCODE MARK1+MARK2
4 189
3 170
5 170
6 165
2 150
1 60
12 48
it worked fine. but i used a where clause to get the first 2 rows and here is what i got.
SQL> select studentcode,mark1+mark2 from mark where rownum < 3 order by (mark1+mark2) desc
STUDENTCODE MARK1+MARK2
3 170
2 150
1 60
as You can see, i don't get the req. result.
how do i get the prob. solved ?For Oracle versions prior to 8.1.5, you will have to create a view and then incorporate that view into your select statement.
create or replace view my_view
is
select studentcode, mark1 + mark2
from mark
order by mark1 + mark2 desc;
select *
from my_view
where rownum <= 2 -
Empty WHERE Clause with AND condition after
I have a question concerning a SQL query that I am using for a report. I have converted an old report to Crystal Reports 2008 and the resulting SQL query no longer works.
After the conversion all the inner joins that were previously used in the report were moved to the FROM clause.
My resulting WHERE clause is as follows:
WHERE AND
"TABLE"."TABLEKEY" IS NOT NULL
I get this error message:
ORA-00936 Missing expression
As you can see there WHERE clause has nothing before the AND condition because all the inner joins have moved to the FROM clause in the new version of Crystal Reports. I am fine with these inner joins moving but how do I take care of this empty condition.
Any help is appreciated.Hi Joshua
Please go through the following SAP note which deals with similar type of issue.
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_erq/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes%7B6163636573733d36393736354636443646363436353344333933393338323636393736354637333631373036453646373436353733354636453735364436323635373233443330333033303331333233313335333533393334%7D.do
Thanks -
Where Clause With Multiple Rows
I am tracking Objects called Incidents. Incidents can be made up of an undetermined number of questions and answers, such that my table structure to store these incidents looks as follows:
INCIDENT_ID QUESTION_ID ANSWER_ID
10001 49100 100 ("YES")
10001 49101 275 ("5 HOURS")
10002 49100 102 ("NO")
10002 49101 276 ("10 HOURS")I allow my users to enter complex queries, such as "give me all incidents where question 49100 equals YES AND question 49101 equals 5 or less, OR where 49100 equals NO and 49101 is greater than 5", etc...
My problem is how to handle these types of complex queries. Right now, I bring all of the rows into a Java object, and then I can analyze the results using Java (this works elegantly and allows me to have very complex formulas).
However, if I have to deal with millions of Incidents and Answers, bringing them all into Java seems to be very time consuming. I'd like to be able to handle everything in the database. Because I allow my users to enter the queries through a "query builder", I can't control how many conditions they might have. In other words, if I try to use inner queries in the WHERE clause, I may exceed limits.
It would be easiest if I could translate this vertical table into a temporary horizontal table, and then run my query on this horizontal table. My problem is that some of my questions have 1000s of answers (where they might be picking from a large select list), and therefore I can't do sums and counts on all the choices in separate columns. If I try a bit field for each column, once again I can run out of space because of the 1000s of possible answers.
Has anyone faced this issue before? What choices do I have to make this all work in the database without having to parse the results in Java?
MichaelI was under the impression that each medication uses a unique id itself (defined perhaps by the medical insurance industry) and that itemized lists contain that code. And thus the user can type in the code.
If so then one could handle the interface using both of the following methods.
- The user can type in the id (this is validated.)
- The user can push a button to bring up a dialog that provides the list and also provides an intelligent search option. (Or the id field can just be an aspect of the intelligent search.)
Even in a small doctor's office experienced users will probably know the common ids and it would be simpler for them to type that in. In a processing center this would be more important as the time to process each transaction directly impacts the bottom line. This becomes much more relevant when the users are paid bonuses based on how many transactions they process (and managers might get that as well.) -
Creating dynamic where clause with string delimiter " ; "
hi...
i need a solution for complex problem like, 1. start_date IN date,
end_date IN date,
shift_type IN varchar2
i will get shift_type as "first_shift" or "first_shift;second_shift" or "first_shift;second_shift;third_shift" ....etc any combination. where fist & second & third shits are nothing but 1 , 2 , 3. i need to find out data between start_date and end_date in combination of shifts ( may be 1;2 or 1;3 or 1;2;3 or 2;3 ...etc) . now i need to write this code in dynamic where clause ...i tried in different ways...but not succeeded. can anybody guide me step by step...or with script.
NOTE: there is a table called "shift" with data like
shift_type shift_mode
1 first_shift
2 second_shift
3 third_shiftHi,
Whenever you have a problem, post a little sample data (CREATE TABLE and INSERT statements) and the results you want from that data.
If the question involves parameters, give a few different sets of parameters and the results you want for each set, given the same sample data.
It's unclear that you need dynamic SQL at all.
If shift_type is a variable, that can be either a single value or a ;-delimited list (such as '1;3'), you can compare that to a column called shift_column like this:
WHERE ';' || shift_type || ';' LIKE
'%;' || shift_column || ';%'No dynamic SQL or PL/SQL required.
If you really do want to use dynamic SQL, these two pages should gives you some ideas:
http://www.oracle-base.com/articles/misc/DynamicInLists.php
http://tkyte.blogspot.com/2006/06/varying-in-lists.html -
Passing where clause with spaces from forms to reports
Hi,
Has anybody passed where clause as lexical parameter with spaces from forms to preports..
I have seen people mention that, we can replace the spaces with special characters and then replace it again in the before trigger report..does anyone have a working example of that??
Thanks.i solved the issue..
i had written the procedure in the before report
trigger instead of writing it in the before parameter
form trigger..
it works perfecto now..
Thanks.We had removed the spaces and used commas to delimit each item.
So you are saying spaces are not a problem in 10g? -
Hi,
Is there a nice way to specify the list eg.
where itemNo IN(:1/?),
where i can just set the where clause parameter with a array?If TABLE_OF_VARCHAR is a table type declared like this:
CREATE TYPE TABLE_OF_VARCHAR AS TABLE OF VARCHAR2(2000);
Then you can do this:
select ...
from ...
where column_value in (select *
from TABLE(CAST(? as TABLE_OF_VARCHAR)))
this allows you to set an array-valued bind variable and cast its values into a table to select in the IN clause.
This lets you have a variable number of args in the IN clause in a way that doesn't change the text of the SQL statement each time.
I've posted a working sample project at:
http://www.geocities.com/smuench/ArrayOfStringDomain.zip -
Where clause with 3 tables?
hi all
can anyone check the following query for me and guide me can we join 3 tables with where clause?
SELECT ALL SLIP.NUM, SLIP.NAME, SLIP.NAT, SLIP.JOIN, SLIP.JOB, SLIP.GENDER,
SLIP.BANK, SLIP.ACCOUNT, SLIP.YEAR, SLIP1.NUM, SLIP1.BASIC, SLIP1.CODE,
SLIP1.HOUSE, SLIP1.TRANS, SLIP1.WATER, SLIP2.NUM, SLIP2.AMOUNT,
SLIP2.OTHER, SLIP2.DEDUCT, SLIP2.MONEY, SLIP2.TOTAL, SLIP2.NET
FROM SLIP, SLIP1, SLIP2
WHERE (SLIP.NUM = :p_num
AND SLIP.NAME = :p_name
AND SLIP.NAT = :p_nat
AND SLIP.JOIN = :p_join
AND SLIP.JOB = :p_job
AND SLIP.GENDER = :p_gender
AND SLIP.BANK = :p_bank
AND SLIP.ACCOUNT = :p_account
AND SLIP.YEAR = :p_year
AND SLIP1.NUM = :p_num1
AND SLIP1.BASIC = :p_basic
AND SLIP1.CODE = :p_code
AND SLIP1.HOUSE = :p_house
AND SLIP1.TRANS = :p_trans
AND SLIP1.WATER = :p_water
AND SLIP2.NUM = :p_num2
AND SLIP2.AMOUNT = :p_amount
AND SLIP2.OTHER = :p_other
AND SLIP2.DEDUCT = :p_deduct
AND SLIP2.MONEY = :p_money
AND SLIP2.TOTAL = :p_total
AND SLIP2.NET = :p_net)
AND (SLIP.NUM = SLIP1.NUM)
sarah
Edited by: SarahSarahSarah on Aug 16, 2009 8:38 AMI would guess, at a minimum, that you want to have a WHERE clause that joins SLIP2 to either SLIP or SLIP1. Since you know your data model, you'll have to tell us how SLIP2 relates to the other two tables.
If you really have tables named SLIP, SLIP1, and SLIP2, I would have some rather serious concerns about your data model. Having three tables that store different data but have virtually the same name would be rather concerning.
Justin
Maybe you are looking for
-
How do I compile a java file in eclipse
Hi, I have just installed eclipse and added a plugin for tomcat. I created a new tomcat project and have been trying out several jsp files. Everything nice and dandy. Now there is a bean in the tutorial that I am doing. So I use the context menu, new
-
I have several computers with Windows 7 Ultimate installed here at the Pioneer Library System. We have ~20 workstations running XP Pro on a Active Directory domain and are planning on rolling out Windows 7 this fall. I am running Windows 7 to test ou
-
Hi All, We have 2 ODS. We are using both to create a Multicube. ODS1 Key Delivery Delivery Itm Order Order Itm Batch Data Qt
-
Report Output in a single page,
I have a report which is registered in apps, the ouput is around 20 pages, now my question is, is there any options to get the ouput in a single page with out any pagebreaks. help needed urgent thanks in advance
-
Hate v.7.0.1.8, tried to go back to v.6 and cant.
WinXP Media edition I successfully uninstalled v.7 and reinstalled v.6, since it seems that other people have been satisfied with that solution, but when I click on the icon now, iTunes doesn't start, and I get the message "The file iTunes Library.it