Problem with decode function.
Hi,
Can anyone of you help me out in solving this?
It is like i wish to give different select statements according to the value of a parameter entered by user USING DECODE FUNCTION.The select statement contains some other select statements inside it.So when i execute it,it is giving error like 'ORA-00913-too many values(even when i enclose select statements within brackets).
ORA-00913 too many values
Cause: The SQL statement requires two sets of values equal in number. This error occurs when the second set contains more items than the first set. For example, the subquery in a WHERE or HAVING clause may return too many columns, or a VALUES or SELECT clause may return more columns than are listed in the INSERT.
Action: Check the number of items in each set and change the SQL statement to make them equal.
the above is from oracle documentation. the brackets is not the problem, u must be using multiple items in the integrated decode queries. If the problem still exists post ur DML for further analysis.
zaibi.
Similar Messages
-
Problem with decode function while dispaly the data ( urgent )
Hi friends ,
I want the output like this.
sample:
CLIENT CODE: 00027
PLAN CODE: 01
SSN Last Name First Name TYPE Frequency Amount
123-45-6036 Perrault Julia D M 250.00
123-45-6036 Perrault Julia D Q 400.00
CLIENT CODE: 00027
PLAN CODE: 02
SSN Last Name First Name TYPE Frequency Amount
123-45-6036 Perrault Julia D S 1000.00
123-45-7042 Testaverde Alexander D B 50.00
this is my query:
SELECT distinct pln.plan_code,
ind.ssn,
ind.last_name,
ind.first_name,
pln.clt_client_id,
DECODE(rp.account_code,'AMNT',rp.userid,NULL) amount,
DECODE(rp.account_code,'FREQ',rp.userid,NULL) frequence,
DECODE(rp.account_code,'TYPE',rp.userid,NULL) type
FROM rp_extract_recon rp,
plan pln,
indicative ind
where ind.indicative_id in ( select distinct
rp1.ind_indicative_id
from rp_extract_recon rp1
where rp1.rp_extract_recon_id =
rp.rp_extract_recon_id )
and ind.clt_client_id = pln.clt_client_id
and pln.plan_id = rp.pln_plan_id
and rp.bat_batch_info_id = 14078
and rp.rp_report_type_code = 'TEST'
output for above query:
PLAN_C SSN LAST_NAME FIRST_NAME CLT_C AMOUNT
FREQUENCE TYPE
01 123456036 Perrault Julia 00027 250.00
01 123456036 Perrault Julia 00027 400.00
01 123456036 Perrault Julia 00027 M
01 123456036 Perrault Julia 00027 Q
01 123456036 Perrault Julia
00027 D
02 123456036 Perrault Julia 00027 1000.00
02 123456036 Perrault Julia 00027 S
02 123456036 Perrault Julia
00027 D
02 123457042 Testaverde Alexander 00027 50.00
02 123457042 Testaverde Alexander 00027 B
02 123457042 Testaverde Alexander
00027 D
11 rows selected.
11 rows selected.
how can i get the above ouput .
i want the type,frequency,amount values in one line.
thanks for u r kind help
sriniHi Srini,
Add Max in the begining and group by at the end of statement.
Please let me know in both cases if it works or not.
thanks
for example
SELECT distinct pln.plan_code,
ind.ssn,
ind.last_name,
ind.first_name,
pln.clt_client_id,
MAX(DECODE(rp.account_code,'AMNT',rp.userid,NULL) amount,
DECODE(rp.account_code,'FREQ',rp.userid,NULL) frequence,
DECODE(rp.account_code,'TYPE',rp.userid,NULL) type )
FROM rp_extract_recon rp,
plan pln,
indicative ind
where ind.indicative_id in ( select distinct
rp1.ind_indicative_id
from rp_extract_recon rp1
where rp1.rp_extract_recon_id =
rp.rp_extract_recon_id )
and ind.clt_client_id = pln.clt_client_id
and pln.plan_id = rp.pln_plan_id
and rp.bat_batch_info_id = 14078
and rp.rp_report_type_code = 'TEST'
GROUP BY
pln.plan_code,
ind.ssn,
ind.last_name,
ind.first_name,
pln.clt_client_id, -
Problem with decode function ( urgent )
Hi friends ,
this is my query
SELECT DECODE(rp.account_code,'TYPE',rp.userid,NULL) type,
DECODE(rp.account_code,'FREQ',rp.userid,NULL) frequence,
DECODE(rp.account_code,'AMNT',rp.userid,NULL) amount
FROM rp_extract_recon rp,
plan pln,
indicative ind
where ind.indicative_id in ( select distinct
rp1.ind_indicative_id
from rp_extract_recon rp1
where rp1.rp_extract_recon_id =
rp.rp_extract_recon_id )
and ind.clt_client_id = pln.clt_client_id
and pln.plan_id = rp.pln_plan_id
and rp.bat_batch_info_id = 14078
and rp.rp_report_type_code = 'TEST'
getting output like this:
TYPE FREQUENCE AMOUNT
S
D
1000.00
M
D
250.00
Q
D
400.00
B
D
50.00
12 rows selected.
i want the output like this :
TYPE Frequency Amount
D M 250.00
D Q 400.00
D S 1000.00
D B 50.00
how can get the above out put.
thanks for u r kind help
sriniTry formatting your columns
col type for a4
col frequence for a4
col amount for a4
although from looking at you query, I don't understand the
output you pasted. YOu have 3 decode statments based on the
same fields?
Hi friends ,
this is my query
SELECT DECODE(rp.account_code,'TYPE',rp.userid,NULL) type,
DECODE(rp.account_code,'FREQ',rp.userid,NULL) frequence,
DECODE(rp.account_code,'AMNT',rp.userid,NULL) amount
FROM rp_extract_recon rp,
plan pln,
indicative ind
where ind.indicative_id in ( select distinct
rp1.ind_indicative_id
from rp_extract_recon rp1
where rp1.rp_extract_recon_id =
rp.rp_extract_recon_id )
and ind.clt_client_id = pln.clt_client_id
and pln.plan_id = rp.pln_plan_id
and rp.bat_batch_info_id = 14078
and rp.rp_report_type_code = 'TEST'
getting output like this:
TYPE FREQUENCE AMOUNT
S
D
1000.00
M
D
250.00
Q
D
400.00
B
D
50.00
12 rows selected.
i want the output like this :
TYPE Frequency Amount
D M 250.00
D Q 400.00
D S 1000.00
D B 50.00
how can get the above out put.
thanks for u r kind help
srini -
Problem with decode function while dispaly the data
Hi friends ,
I want the output like this.
sample:
CLIENT CODE: 00027
PLAN CODE: 01
SSN Last Name First Name TYPE Frequency Amount
123-45-6036 Perrault Julia D M 250.00
123-45-6036 Perrault Julia D Q 400.00
CLIENT CODE: 00027
PLAN CODE: 02
SSN Last Name First Name TYPE Frequency Amount
123-45-6036 Perrault Julia D S 1000.00
123-45-7042 Testaverde Alexander D B 50.00
this is my query:
SELECT distinct pln.plan_code,
ind.ssn,
ind.last_name,
ind.first_name,
pln.clt_client_id,
DECODE(rp.account_code,'AMNT',rp.userid,NULL) amount,
DECODE(rp.account_code,'FREQ',rp.userid,NULL) frequence,
DECODE(rp.account_code,'TYPE',rp.userid,NULL) type
FROM rp_extract_recon rp,
plan pln,
indicative ind
where ind.indicative_id in ( select distinct
rp1.ind_indicative_id
from rp_extract_recon rp1
where rp1.rp_extract_recon_id =
rp.rp_extract_recon_id )
and ind.clt_client_id = pln.clt_client_id
and pln.plan_id = rp.pln_plan_id
and rp.bat_batch_info_id = 14078
and rp.rp_report_type_code = 'TEST'
output for above query:
PLAN_C SSN LAST_NAME FIRST_NAME CLT_C AMOUNT
FREQUENCE TYPE
01 123456036 Perrault Julia 00027 250.00
01 123456036 Perrault Julia 00027 400.00
01 123456036 Perrault Julia 00027 M
01 123456036 Perrault Julia 00027 Q
01 123456036 Perrault Julia
00027 D
02 123456036 Perrault Julia 00027 1000.00
02 123456036 Perrault Julia 00027 S
02 123456036 Perrault Julia
00027 D
02 123457042 Testaverde Alexander 00027 50.00
02 123457042 Testaverde Alexander 00027 B
02 123457042 Testaverde Alexander
00027 D
11 rows selected.
11 rows selected.
how can i get the above ouput .
i want the type,frequency,amount values in one line.
please help me.
thanks for u r kind help.
sriniHi.
I have not tested this my self, byt tryit.
SELECT pln.plan_code,
ind.ssn,
ind.last_name,
ind.first_name,
pln.clt_client_id,
MAX(DECODE(rp.account_code,'AMNT',rp.userid,NULL)) amount,
MAX(DECODE(rp.account_code,'FREQ',rp.userid,NULL)) frequence,
MAX(DECODE(rp.account_code,'TYPE',rp.userid,NULL)) type
FROM rp_extract_recon rp,
plan pln,
indicative ind
where ind.indicative_id in ( select distinct
rp1.ind_indicative_id
from rp_extract_recon rp1
where rp1.rp_extract_recon_id =
rp.rp_extract_recon_id )
and ind.clt_client_id = pln.clt_client_id
and pln.plan_id = rp.pln_plan_id
and rp.bat_batch_info_id = 14078
and rp.rp_report_type_code = 'TEST'
GROUP BY pln.plan_code,
ind.ssn,
ind.last_name,
ind.first_name
/Uffe -
OWB3i - Validate with DECODE function
Hi,
in OWB 3i when I validate an expression defined inside an expression operator with DECODE() function (which is not include in default transformation) come this error:
Line 1, Col 1:
PLS-00204: function or pseudo-column 'DECODE' may be used inside a SQL statement only
but it seems only a warning because when i generate the scripts and run no other error happen and all works fine.
RegardsHi,
Welcome to the forum!
When you use a default value, the last argument to DECODE is the actual value you want as a default.
For example:
SELECT ename
, deptno
, DECODE ( deptno
, 30 , 'Sales'
, 'All others' -- Default value
) AS dname
FROM scott.emp
ORDER BY ename
;Output:
ENAME DEPTNO DNAME
ADAMS 20 All others
ALLEN 30 Sales
BLAKE 30 Sales
CLARK 10 All others
FORD 20 All others
JAMES 30 Sales
JONES 20 All others
KING 10 All others
MARTIN 30 Sales
MILLER 10 All others
SCOTT 20 All others
SMITH 20 All others
TURNER 30 Sales
WARD 30 Sales
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
Explain, using specific examples, how you get those results from that data.
If you can show the problem using commonly available tables (such as those in the scott schema) then you don't need to post any sample data; just the results and the explanation.
Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
See the forum FAQ {message:id=9360002} -
Problem with decode!!!
Hi guys,
I have a problem with "decode"!
How can I tell the decode expression
that if a rowset don't exists --> then doing something.
I've tried that with "NULL" but that don't works.
here my code:
I wanted that if tx.text doesn't exists then
it returns fs.anlageschwerpunkt_lang, and otherwise
it returns tx.Text.
select
decode(tx.Text,NULL,fs.anlageschwerpunkt_lang,tx.Text) Anlageschwerpunkt_1 from
POI.Fondsstamm fs,
Texte tx,
Texttypstamm txy
where
tx.match='amfcomm'
and tx.match=rtrim(fs.match)
and tx.TEXTTYPID=txy.TEXTTYPID
and txy.BEREICHSID=14
and txy.texttyp='Marketingstrategie'
I hope somebody of you can help me
thanxx
SchoeibI read Schoeibs question differently; no ROWS are being returned. In that case you cannot expect DECODE or any other function to do anything. Assuming that rows always exist in fs and txy and are only missing in tx, then you need an outer join. Note that the join of tx.match = rtrim(fs.match) has been altered to avoid outer joining to more than one table. As mentioned before, although the decode is OK, NVL could be used instead.
select
decode(tx.Text,NULL,fs.anlageschwerpunkt_lang,tx.Text) Anlageschwerpunkt_1 from
POI.Fondsstamm fs,
Texte tx,
Texttypstamm txy
where
tx.match(+)='amfcomm'
and rtrim(fs.match) = 'amfcomm'
and tx.TEXTTYPID(+)=txy.TEXTTYPID
and txy.BEREICHSID=14
and txy.texttyp='Marketingstrategie' -
For users having problems with Mail functionality...
Hello! I have been having problems with Mail functionality as well, so, I took a few steps to see if I could solve the problem on my own.
My problems were:
Mail would freeze when sending mail, or, when I pressed quit, it would freeze.
If I toggled between inboxes too much it would freeze up.
Even after trying the many techniques others offered on this board, Mail still froze up. So.. here's what I did:
1.) Turn off the auto-retrieve mail function in the preferences/general menu. Set it to a manual check. Just check it yourself every once in awhile. It may not be as convenient, but it works, trust me.
2.) Under the fonts and colors menu, set all three fonts to the SAME font (mines Century Schoolbook, but anything works) and turn off fixed-width font. Sometimes mail has a tough time decoding and working with texts, and causes it to freeze.
3.) Clean our your main inbox! Place the emails that you want to keep, but don't need to be in your inbox in a new folder on your inbox bar (mines aptly named 'Saved Messages.' That way, when you open up Mail to your default account, it doesn't have 1,000+ messages to index. Also, try to keep the inboxes from having more than 100-200 messages per. It seems to frown on any more than that.
After trying these three easy, steps, restart mail and see if things run smoother. I have had no problems since these changes, and mail runs a ton better. Plus you don't have to worry about deleting your library/mail folder anymore. Let me know if things work out so I can see if my theory is a universally proven thing. Thanks and good luck!
iMac G5 20" Mac OS X (10.4.5)Good question. I have worked very little with IMAP other than as a testing device, so, on a daily routine I cannot say how it would function. However, I can only expect that by having the option to download all emails for offline viewing selected, you are right in it being a lag creator. Another suggestion would be, if you are running a single-computer setup, to have the account delete emails from the server after recieving them on your computer. Thus, you reduce the risk of repeat downloads or unnecessary build-up on the server end. DO NOT select this option if you run multiple computer set ups on one AppleMail account system or you will cause some discrepancies and/or data loss from system to system. Or, if you have emails redirected from a seperate server to Mail (i.e. I redirect mail from my university email account into Mail so that I don't have to go to the web-mail site to check it--> just like Gmail or Yahoo etc etc) you won't be able to check them from the web-based email system if you have the system delete them. Ok that sounded confusing. Solution: have the system remove emails from the server after a week (or any period of time, just not immediately) so that, in the off-chance you need to use the online system, you will have access, and will give you a chance to check the emails on other systems without a threat of data corruption (by corruption i mean that frustrating feeling you get when you can't find that super important email that was in your inbox just 10 seconds ago on your desktop etc.)
I will see if I can learn anything more about IMAP Ernie. Its definitley the biggest problem source for Mail, POP and .Mac being simple and functional as long as you don't play with the settings too much. As far as the issue of Offline viewing goes, try turning it off and seeing how Mail functions.
BEFORE you turn it off, however, I recommend saving all of your emails in your inbox as a text file or something so, in case the server burps and has a brain flatuence, you don't lose anything. Been there, done that, thrown the books against the wall in a frustrated rage.
My only reserve about the Offline Viewing is whether or not Mail will, when you click "recieve mail," have to re-download the emails from the server each time. If so, then it may end up taking longer and lagging more. The issue here is obviously minimizing the amount of activity between Mail and the email server without jeapordizing information on the server or multiple Mail programs on the same account. When we can find that balance, I think Mail's potential will be realized. Keep the questions coming. -
Error while replacing IF statements with DECODE function in procedure
Hi All,
I have created a procedure which has nested IF statements. Now I want to replace the IF statements with DECODE functions to improve performance.
Procedure:
IF (var_int_sev = '0')
THEN
var_sev := '2';
ELSE
SELECT sev
INTO var_int_sev
FROM errorconfig
WHERE errorcode = var_errorcode;
var_sev := var_int_sev;
END IF;
I converted the above IF statement into DECODE function as mentioned below:
var_Sev := DECODE(var_int_sev,0,2,SELECT severity FROM errorconfig WHERE errorcode=var_ErrorCode)
But it throws below error at the select statement used inside DECODE.
Error(58,51): PLS-00103: Encountered the symbol "SELECT" when expecting one of the following: ( - + case mod new not null others <an identifier> <a double-quoted delimited-identifier> <a bind variable> avg count current exists max min prior sql stddev sum variance execute forall merge time timestamp interval date <a string literal with character set specification> <a number> <a single-quoted SQL string> pipe <an alternatively-quoted string literal with character set specification> <an alternativ
Can someone help me in converting the IF to DECODE in the above case. Also how can we use a select statement inside decode.instead of trying to rewrite all your code and hoping that the performance will be better, it's a better option to investigate and find out which part of your application is slow
read this:
When your query takes too long ... -
Problem with DECODE block in WHERE clause
Hi,
I'm facing problem with DECODE statement. I just simulated my problem in the simple way as follows. If I execute this following query, I should get "hello", but I'm not getting anything (ZERO rows returned).
SELECT 'hello' FROM DUAL
WHERE 'sample1' in (DECODE(1, 1, '''sample1'', ''sample2'', ''sample3''',
2, '''sample4'', ''sample5'', ''sample6'''
I think some problem is there in my WHERE clause.
But When I'm exeucting the following query as a seperate query, then I'm getting the value of DECODE block properly, but didn;t understnad why its not returning the same way when I'm putting the same DECODE statement in WHERE clause.
SELECT DECODE(1, 1, '''sample1'', ''sample2'', ''sample3''',
2, '''sample4'', ''sample5'', ''sample6'''
FROM DUAL;
Please help me to get out of this problem. Thank you so much in advance.
Thanks,
Ramji.The value returned by SELECT DECODE(1, 1, '''sample1'', ''sample2'', ''sample3''',2, '''sample4'', ''sample5'', ''sample6''') FROM DUAL;
'sample1', 'sample2', 'sample3' is a single string. Consider it x.
SELECT 'hello' FROM DUAL WHERE 'sample1' in ( DECODE(1, 1, '''sample1'', ''sample2'', ''sample3''',2, '''sample4'', ''sample5'', ''sample6'''));
is like SELECT 'hello' FROM DUAL WHERE 'sample1' in ('x');
or
SELECT 'hello' FROM DUAL WHERE 'sample1' in ('''sample1'', ''sample2'', ''sample3''') and not
SELECT 'hello' FROM DUAL WHERE 'sample1' in ('sample1', 'sample2', 'sample3');
For this same reason SELECT 'hello' FROM DUAL WHERE 'sample1' in (select '''sample1'', ''sample2'', ''sample3''' from dual);
also does'nt work.
Please use INSTR to find whether 'sample1' exists in the string 'sample1', 'sample2', 'sample3'. -
Problems with decoding an latin1-encoded url
Hi,
i have a problem with decoding german umlaut-characters from an URL.
I'm using Tomcat 5.5 on a Linux server and one on a windows machine for development. Both webapps have the same configurations.
A servlet decodes the URL-String, parses it and stores the parsed data into a mysql-DB.
For decoding the query-string i'm using org.apache.commons.codec.net.URLCodec.URLCodec.decode .
Here's the code:
String unparsedParameters = request.getQueryString();
URLCodec codec = new URLCodec("ISO-8859-1");
result = codec.decode(unparsedParameters);Here an example for a query-string: http://servername:8080/servlet/Import?Etwas%20wurde%20am%2025.08.2010%2010%3A16%3A50%20*ge%E4ndert*
On the windows machine the word "*geändert*" is decoded correctly. But on the linux server i get "*ge?ndert*". It makes no difference if i write the result into the database or just into a logfile.
Can anyone help?
Thanks in advance.
Edited by: sol1640 on Aug 26, 2010 5:59 AMProblem resolved.
Instead of using the decode-method as described in my fist message now i'm doing the folowing:
fURLDecodigCharset = "ISO8859-1";
byte[] bytes = originalParam.getBytes(fURLDecodigCharset);
byte[] decodeUrl = URLCodec.decodeUrl(bytes);
result = new String (decodeUrl, fURLDecodigCharset);because the method "decode" decodes the string by using the defaultcharset. And that was the problem.
>
The default charset is determined during virtual-machine startup and typically depends upon the locale and charset of the underlying operating system.
>
Thats why i've got different behaviours on different systems.
Thanks -
Error thread java : problem with the function "resume 0x***" (forum sun)
One problem with the function of jdb occured when I tried to use it to
pilot the processor with differents threads. In fact, I use a simple example with 2 threads.
I stop the two threads with two breakpoint, and I want to resume one or the other (with the function "resume 0x****"), the one wich I resumed stop again on the breackpoint and I decide again to resume one or the other. All of that to obtain a tree of execution.
I give you the code of the class and the code of jdb.
CLASS: (it's just a object Room with a variable degre that I increment and decrement with two threads increase and decrease)
public class Test{
public static void main(String[] args){
Room r = new Room();
decrease de = new decrease(r);
increase in = new increase(r);
de.start();
in.start();
class Room {
private volatile int degre=20;
public void more(){
degre += 4;
public void less(){
degre -= 3;
class decrease extends Thread{
private Room room;
public decrease(Room r){
room =r;
public void run(){
try{
while (!interrupted()){
room.less();
catch(InterruptedException e) {}
class increase extends Thread{
private Room room;
public increase(Room r){
room =r;
public void run(){
try{
while (!interrupted()){
room.more();
catch(InterruptedException e) {}
JDB:
Initializing jdb ...
stop at Test:7Deferring breakpoint Test:7.
It will be set after the class is loaded.
runrun Test
Set uncaught java.lang.Throwable
Set deferred uncaught java.lang.Throwable
>
VM Started: Set deferred breakpoint Test:7
Breakpoint hit: "thread=main", Test.main(), line=7 bci=30
7 in.start();
main[1] stop at room:16
Set breakpoint room:16
main[1] stop at room:20
Set breakpoint room:20
main[1] resume
All threads resumed.
>
Breakpoint hit: "thread=Thread-0", room.less(), line=20 bci=0
20 degre -= 3;
Thread-0[1] threads
Group system:
(java.lang.ref.Reference$ReferenceHandler)0x10d Reference Handler cond. waiting
(java.lang.ref.Finalizer$FinalizerThread)0x10c Finalizer cond. waiting
(java.lang.Thread)0x10b Signal Dispatcher running
Group main:
(decrease)0x146 Thread-0 running (at breakpoint)
(increase)0x147 Thread-1 running (at breakpoint)
(java.lang.Thread)0x148 DestroyJavaVM running
Thread-0[1] resume 0x147
Thread-0[1]
Breakpoint hit: "thread=Thread-1", room.more(), line=16 bci=0
16 degre += 4;
Thread-1[1] resume 0x147
Thread-1[1]
Breakpoint hit: "thread=Thread-1", room.more(), line=16 bci=0
16 degre += 4;
Thread-1[1] print degre
degre = 24
Thread-1[1] resume 0x146 //It's here the problem, thread 0x146 have to stop on the //next breakpoint of decrease but nothing happen
Thread-1[1] resume 0x147
Thread-1[1]
Breakpoint hit: "thread=Thread-1", room.more(), line=16 bci=0
16 degre += 4;
Thread-1[1] clear
Breakpoints set:
breakpoint Test:7
breakpoint room:16
breakpoint room:20
PS: I tried many other examples with other class and other kind of breakpoints, but, in any cases, on thread doesn't manage to resume. When I try with general resume (no specification of the thread), It works but it isn't interresting for me because I want to decide wich thread continue his execution.Hi,
I have read the FAQ of the JMF.
The problem was the jar files of the JMF were not in the JRE\BIN\EXT
folder of the Java runtime!
now it works!
thanks
Reg -
Problem with 'GetType' Function calling in MSVC++
Hello
I have problem with the function in TestStand API .
When I call the function " GetType " with the following statements in
a DLL called from TestStand (NI) implemented in MS VC ++
, it does not work and this exception is caught by the ONLY ' try catch ' block
to catch exceptions in TestStand API giving the error message
" Unexpected operating system error".
VARIANT_BOOL ok;
VARIANT_BOOL hi;
BSTR Name;
PropertyObject *property = (*step_)->AsPropertyObject();
( *step_ is a STEP Object of type Step* *step_ )
property = property->GetPropertyObject( "TS.SData", 0);
enum TS:ropertyValueTypes i = property->GetType( "" , 0 , &hi , &ok
, &Name);//Problem
Please solve my problem.
You can email me at [email protected]
Thankyou very much.
Best regards
Fahad EjazHello,
The problem is that the Name is not initialized (the BSTR is defined as OLECHAR*). Thus, replace the
BSTR Name;
declaration with the following lines:
char buf[1024];
BSTR Name = _bstr_t(buf);
This should solve the problem.
Best Regards,
Silvius
Silvius Iancu -
Problem with CONTAINS function
Hi all!!
i got a problem with contains function. i'm running oracle 11g.
if i execute this query:
SELECT x.lid as id, x.sztitular as titular, e.szname as proName, x.szresumen as resumen, b.sztitle as catName,
f.szname as secName, d.szname as cliName, x.datecreation as datecreation
FROM CPR_PRACTICAL_CASE x,ctg_category b, CPR_CLIENT d, pro_product e, CAT_SECTOR f, CPR_PCASE_PRODUCT g, CPR_PCASE_SECTOR h,
PRO_PRODUCTCATEGORY i WHERE x.lid = g.lpcaseid and e.lid = g.lproductid and x.lid = h.lpcaseid
and f.lid = h.lsectorid and x.lclientid = d.lid and i.lproductid = e.lid and b.lid = i.lcategoryid
AND x.szlocale = 'es-ES' AND x.bavailable = '1'i get 1 row as result with the column sztitular = "rodillos de medidas"
if i only add one more sentece to that query:
AND CONTAINS( x.sztitular, 'rodillos',1) >0the query returns an empty set.. i really don't understand why because the term "rodillos" is present in the row's column called "sztitular"...
i've put an index on that column:
create index ITXT_TITULAR on CPR_PRACTICAL_CASE(sztitular) INDEXTYPE IS CTXSYS.CONTEXT;any help?
many thanks!!!!
Edited by: ElMazzaX on May 21, 2012 5:51 PM
Edited by: ElMazzaX on May 21, 2012 5:53 PMHow are you synchronising the index?
http://docs.oracle.com/cd/E11882_01/text.112/e24435/ind.htm#i1008452
Also see the Oracle Text forum:
Text -
Performance problem with OLE_FLUSH_CALL function module
Hello Everyone,
I am facing problem with OLE_FLUSH_CALL function module (execution is taking long time which is going to be dump error).
Could you please help me in knowing solution for this problem?
Thanking you in advance.
SrinivasHi Srinivas,
the OLE_FLUSH_CALL does an RFC from ABAP backend to frontend UI. So high execution time could result from high network time, for example latency between UI and backend server.
How many UI interaction steps did you measure for the trace above? Ideally, there should only be one OLE_FLUSH_CALL per user interaction step. If its more, the application is not written in an optimized way.
Best Regards, Randolf -
Problem with BAPI_SALESORDER_CHANGE function module
I know lot of posts have been done about problems with this function module. However I was not able to find the answer to my problem. Hence posting a new thread
I have the following code which changes the reason rejection (if required to 'ZF') and also updates the sales order quantity.
The code works absolutely fine as long as the PGI date of the order item is either today or in the future. However if the PGI date of the order item is in the past. I get an error in the t_return table with error type 'E' saying 'PGI date is in the past hence could not update the item'.
If I try to update the same order quantity in VA02 for the item with PGI date in the past it does so without any problem.
Can someone please suggest what the problem might be. Or if there is some other way I can update the quantity. (I dont want to use BDC)
FORM change_sales_order_item USING value(r_rtb_posnrs) TYPE zpsd_ztsdrtb_ro_track
CHANGING r_return TYPE type_t_bapiret2.
DATA: v_order_header_in TYPE bapisdh1,
v_order_header_inx TYPE bapisdh1x,
t_schedule_lines TYPE bapischdl OCCURS 0 WITH HEADER LINE,
t_schedule_linesx TYPE bapischdlx OCCURS 0 WITH HEADER LINE,
v_temp_rtb_vbeln TYPE vbeln,
v_temp_rtb_posnr TYPE posnr,
wa_old_rtb_posnrs TYPE ztsdrtb_ro_track,
t_item_in TYPE bapisditm OCCURS 0 WITH HEADER LINE,
t_item_inx TYPE bapisditmx OCCURS 0 WITH HEADER LINE,
v_rtb_old_vbeln TYPE zrtbvbeln,
v_rtb_old_posnr TYPE zrtbposnr,
v_ro_old_vbeln TYPE zrovbeln,
v_ro_old_posnr TYPE zroposnr,
v_rtb_count TYPE i,
v_next_row_index TYPE i,
v_update_order_flg TYPE char1, "Update the sales order flag
v_rtb_record_counter TYPE i,
v_original_vbeln TYPE vbeln,
t_bapiret TYPE STANDARD TABLE OF bapiret2.
FIELD-SYMBOLS: <wa_r_rtb_posnrs> TYPE ztsdrtb_ro_track,
<wa_r_rtb_posnr_next> TYPE ztsdrtb_ro_track.
CONSTANTS: c_updateflag TYPE bapisditmx-updateflag VALUE 'U'.
v_order_header_inx-updateflag = 'U'.
Get rid of the duplicate records for the same RTB order. Just use
the last record quantity in the internal table
LOOP AT r_rtb_posnrs ASSIGNING <wa_r_rtb_posnrs>.
v_rtb_record_counter = v_rtb_record_counter + 1.
<wa_r_rtb_posnrs>-seqnr = v_rtb_record_counter.
ENDLOOP.
SORT r_rtb_posnrs DESCENDING BY zrtbvbeln zrtbposnr seqnr zrtbconsumedflg.
DELETE ADJACENT DUPLICATES FROM r_rtb_posnrs COMPARING zrtbvbeln zrtbposnr.
DESCRIBE TABLE r_rtb_posnrs LINES v_rtb_count.
v_rtb_record_counter = 0.
v_update_order_flg = space.
LOOP AT r_rtb_posnrs ASSIGNING <wa_r_rtb_posnrs>.
v_rtb_record_counter = v_rtb_record_counter + 1.
v_update_order_flg = space.
Popluate the item quantity update flags for schedule lines
t_schedule_linesx-itm_number = <wa_r_rtb_posnrs>-zrtbposnr.
t_schedule_linesx-sched_line = '0001'.
t_schedule_linesx-updateflag = c_updateflag.
t_schedule_linesx-req_qty = 'X'.
APPEND t_schedule_linesx.
CLEAR t_schedule_linesx.
*Item (Order QQuantity Field to be changed "KWMENG")
t_schedule_lines-itm_number = <wa_r_rtb_posnrs>-zrtbposnr.
t_schedule_lines-sched_line = '0001'.
t_schedule_lines-req_qty = <wa_r_rtb_posnrs>-zrtbchgqty.
APPEND t_schedule_lines.
CLEAR t_schedule_lines.
If fully consumed then set the rejection flag
IF <wa_r_rtb_posnrs>-zrtbconsumedflg = 'X'.
t_item_inx-itm_number = <wa_r_rtb_posnrs>-zrtbposnr.
t_item_inx-updateflag = 'X'.
t_item_inx-reason_rej = 'X'.
APPEND t_item_inx.
CLEAR t_item_inx.
t_item_in-itm_number = <wa_r_rtb_posnrs>-zrtbposnr.
t_item_in-reason_rej = 'ZF'.
APPEND t_item_in.
CLEAR t_item_in.
ELSE.
t_item_inx-itm_number = <wa_r_rtb_posnrs>-zrtbposnr.
t_item_inx-updateflag = 'X'.
t_item_inx-reason_rej = 'X'.
APPEND t_item_inx.
CLEAR t_item_inx.
t_item_in-itm_number = <wa_r_rtb_posnrs>-zrtbposnr.
t_item_in-reason_rej = ' '.
APPEND t_item_in.
CLEAR t_item_in.
ENDIF.
If you have reached the last line of the RTB intern table update the sales order
*Index pointing to the next row
v_next_row_index = v_rtb_record_counter + 1.
IF v_rtb_record_counter = v_rtb_count.
v_update_order_flg = 'X'.
ELSEIF v_rtb_record_counter < v_rtb_count.
Get the next row data
READ TABLE r_rtb_posnrs INDEX v_next_row_index ASSIGNING <wa_r_rtb_posnr_next>.
IF sy-subrc = 0.
IF <wa_r_rtb_posnrs>-zrtbvbeln <> <wa_r_rtb_posnr_next>-zrtbvbeln.
v_update_order_flg = 'X'.
ENDIF.
ENDIF.
ELSE.
v_update_order_flg = space.
ENDIF.
update the rtb orders with quantities and the rejection flag (if required)
IF v_update_order_flg = 'X'.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE' STARTING NEW TASK 'SOUPDATE'
PERFORMING callbk_bapi_salesorder_change ON END OF TASK
EXPORTING
salesdocument = <wa_r_rtb_posnrs>-zrtbvbeln
order_header_in = v_order_header_in
order_header_inx = v_order_header_inx
TABLES
return = t_return
schedule_lines = t_schedule_lines
schedule_linesx = t_schedule_linesx
order_item_in = t_item_in
order_item_inx = t_item_inx.
WAIT UNTIL t_return[] IS NOT INITIAL.
READ TABLE t_return INTO wa_return WITH KEY type = 'E'.
IF sy-subrc <> 0.
ELSE.
r_return[] = t_return[].
MESSAGE ID 'ZSD' TYPE 'E' NUMBER 613.
RAISE errorinorderupdate.
ENDIF.
REFRESH t_schedule_linesx.
REFRESH t_schedule_lines.
REFRESH t_item_in.
REFRESH t_item_inx.
REFRESH t_return.
ENDIF.
ENDLOOP.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
IMPORTING
return = t_bapiret.
ENDFORM. "Change_Sales_Ordersee the following example and try to do this:
i_hdrx-updateflag = 'U'.
*" Fill required SCHEDULE_LINES data.
i_sched-itm_number = p_posnr.
i_sched-sched_line = p_etenr.
i_sched-req_qty = p_reqqty.
i_schedx-updateflag = 'U'.
i_schedx-itm_number = p_posnr.
i_schedx-sched_line = p_etenr.
i_schedx-req_qty = 'X'.
APPEND i_sched.
APPEND i_schedx.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = p_vbeln
order_header_in = i_hdr
order_header_inx = i_hdrx
TABLES
return = i_ret
schedule_lines = i_sched
schedule_linesx = i_schedx.
Maybe you are looking for
-
Can you share books in your iBook account?
-
Project Online - Cube script for building files
Hi We have to use Project Online for our solution and we need to build a reporting database in SQL. Instead of building the schema manually,are there any pre built 2013 ones for use? Also, would there be any ETL scripts for building the cubes availab
-
Replacement for FM DD_PR_GET_STATUS
Hi all, Can anyone please let me know if there is any replacement for FM DD_PR_GET_STATUS as it's obselete. Thanks Ravi
-
ALE - How to use outbound message control on HR to Accounting IDOC?
Hi all, I have a scenario where I want to transfer, using IDocs, Payroll posting to Accounting but I don't want to transfer the posting of Travel trips. Since, on the distribution model, I am using method "AcctngEmplyeeExpnses.Post" which is needed f
-
How to get the data converted in UTF-16 format downloading(local&appl)
Dear Freinds, I have interface program when it is downloading on the desktop and application server some of the characters are not getting displayed properly ( eg : employee name) . Which is not getting downloaded correctly . This as