Analitic functions (problem with SELECT)
Hi!
I've got a problem with analitic functions (I'm newbie in this topic).
I have a table gpw_notowania which have colums: not_open, not_minimum, not_maximum, not_close, not_volume, not_sp_id and not_date.
I need to receive from database the information: what is the open, minimum, maximum, close and sum of volume in every week? I have tried the code below but it tells me: ORA-01791 (marking not_date in ORDER clause).
Help me, please.
SELECT distinct
FIRST_VALUE(not_open) OVER (partition by to_char(not_date,'WW') ORDER BY not_date) as open,
MIN(not_minimum) OVER (partition by to_char(not_date,'WW') ORDER BY not_date) as minimum,
MAX(not_maximum) OVER (partition by to_char(not_date,'WW') ORDER BY not_date) as maximum,
FIRST_VALUE(not_close) OVER (partition by to_char(not_date,'WW') ORDER BY not_date DESC) as close,
sum(not_volume) OVER (partition by to_char(not_date,'WW')) as volume
FROM gpw_notowania
WHERE not_sp_id = 80
ORDER BY not_date;
This is an interesting question.
create table SortWithDistinct(Val1,Val2,sortKey,SubSortKey) as
select 1,3,10,1 from dual union all
select 1,3,10,1 from dual union all
select 1,3,10,1 from dual union all
select 2,4,30,2 from dual union all
select 2,4,30,2 from dual union all
select 3,5,20,1 from dual union all
select 3,5,20,1 from dual union all
select 4,6,10,3 from dual union all
select 5,5,10,2 from dual union all
select 5,5,10,2 from dual union all
select 9,9,10,4 from dual union all
select 6,4,20,2 from dual union all
select 6,4,20,2 from dual union all
select 7,3,30,1 from dual union all
select 7,3,30,1 from dual;
select distinct Val1,Val2
from SortWithDistinct
order by sortKey,SubSortKey;
ORA-01791: not a SELECTed expressionIt is one way that we use "group by".
for instance
select Val1,Val2
from SortWithDistinct
group by Val1,Val2
order by max(sortKey),max(SubSortKey);
Val1 Val2
1 3
5 5
4 6
9 9
3 5
6 4
7 3
2 4It is one way that we use "Inline View".
for instance
select Val1,Val2
from (select distinct Val1,Val2,sortKey,SubSortKey
from SortWithDistinct)
order by sortKey,SubSortKey;
Furthermore, we may use below alternative solution which uses "dense_Rank".
select Val1,Val2
from (select distinct Val1,Val2,
dense_Rank() over(order by sortKey,SubSortKey) as willSortKey
from SortWithDistinct)
order by willSortKey;Because "distinct" works after OLAP.
for instance
SQL> select distinct ColA,ColB,Row_Number() over(order by 1) as Rank
2 from (select 1 as ColA,1 as ColB from dual
3 union all select 1,1 from dual
4 union all select 1,1 from dual
5 union all select 1,1 from dual
6 union all select 2,2 from dual
7 union all select 2,2 from dual
8 union all select 2,2 from dual)
9 order by 1,2,3;
ColA ColB Rank
1 1 1
1 1 2
1 1 3
1 1 4
2 2 5
2 2 6
2 2 7my site :-)
http://www.geocities.jp/oraclesqlpuzzle/1-6.html
Similar Messages
-
Problem with "SELECT...FOR UPDATE OF..." and "POST command" combination
Problem in committing transactions in Multiple Forms (Oracle Forms) with POST built-in command:
Consider that the following statements are written in WHEN-WINDOW-CLOSED trigger of a called form.
Statements in called form (Form name: FORM_CHILD):
go_block('display_block') ;
do_key('execute_query') ;
-- Data from table_b will be populated in this block, based on the value of COLUMN_1 obtained
-- from TABLE_A.
-- Example: If the value of COLUMN_1 is 10, then all the matching records from TABLE_B, which
-- are inserted with value 10 in TABLE_B.COLUMN_1 will be fetched and shown here.
if user_choice = 'YES' then
commit ;
else
rollback ;
end if ;
Statements in calling forms:
There are two calling forms having following statements and it is going to call the above said called form.
CALLING FORM 1
Statements in KEY-COMMIT trigger:
post;
call_form(form_child, no_activate) ;
Statements in ON-INSERT trigger:
select column_1
from table_a
for update of column_1
where column_2 = 'X' ;
update table_a
set column_1 = column_1 + 1
where column_2 = 'X' ;
insert into table_b ...;
insert into table_b ...; Statements in KEY-COMMIT trigger:
post;
call_form(form_child, no_activate) ;
CALLING FORM 2:
Statements in ON-INSERT trigger:
select column_1
from table_a
for update of column_1
where column_2 = 'X' ;
update table_a
set column_1 = column_1 + 1
where column_2 = 'X' ;
insert into table_b ...;
insert into table_b ...;
insert into table_b ...;
Our understanding:
Assume that both the forms are running from two different machines/instances, issuing commit at the same time. In this case, forms will start executing the statements written in ON-INSERT trigger, the moment POST command is executed. Though the commit is issued at the same time, according to oracle, only one of the request will be taken for processing first. Assume that calling form 1 is getting processed first.
So, it fetches the value available in COLUMN_1 of TABLE_A and locks the row from further select, update, etc. as SELECT...FOR UPDATE command is used (note that NOWAIT is not given, hence the lock will be released only when COMMIT or ROLLBACK happens) and proceed executing further INSERT statements. Because of the lock provided by the SELECT...FOR UPDATE command, the statements in calling form 2 will wait for the resource.
After executing the INSERT statements, the FORM_CHILD is called. The rows inserted in to TABLE_A will be queried and shown. The database changes will be committed when user closes the window (as COMMIT is issued in its WHEN-WINDOW-CLOSED trigger). Then the SELECT...FOR UPDATE lock will be released and calling form 2's statements will be executed.
Actual happenings or Mis-behavior:
Calling form 2 starts executing INSERT statements instead of waiting for SELECT...FOR UPDATE lock. Also, the value selected from TABLE_A.COLUMN_1 is same in both the calling forms, which is wrong.
The rows inserted into TABLE_B are having similar COLUMN_1 values in calling form 2 and they are fetched and shown in the called form FORM_CHILD.
Note that in calling form 2 also POST only is issued, but the changes posted there are accessible in calling form 1 also, which is wrong.
Kindly suggest us as to how to fix above problem. It will be much use, if you can send us the information regarding the behavior of Oracle Forms POST built-in also.
Our mail ID: [email protected]
Thanks a lot in advance.You have several problems:
1. On-Insert will ONLY run if you have created a new record in a base-table block. If you haven't done that, then the POST command will not cause it to run.
2. Select for update without a "no wait" will lock records for the first form, but when the second form tries this, it will hit the ORA-00054 exception, and will NOT wait. The only way you could make it wait is to issue an UPDATE sql command, which is not such a good way to go.
All POST does is issues SQL insert or update commands for any changes the user has made to records in a form's base-table blocks, without following with a Commit command.
Also understand that Commit is the same as Commit_Form, and Rollback is the same as Clear_Form. You should read up on these in the Forms help topics. -
Problem with selecting text in Adobe Reader XI
Hi all, I am encountering a problem with Adobe Reader XI and it is very strange I could not find an alike issue on the internet so I guess I have to submit a question with it.
So here it is, I am using Adobe Reader XI Version 11.0.2, operating system: Windows 7. I do not know it starts from when but it has the problem with selecting text - to be copied in pdf documents. I ensure that the documents are not scanned documents but word-based documents (or whatever you call it, sorry I cannot think of a proper name for it).
Normally, you will select the text/paragraph you want to copy and the text/paragraph will be highlighted, but the problem in this case that I cannot select the text/paragraph, the blinking pointer (| <-- blinking pointer) will just stays at the same location so I cannot select/highlight anything to be copied. It happens oftenly, not all the time but 90%.
This is very annoying as my work involves very much with copying text from pdf documents, I have to close the pdf file and then open it again so I can select the text but then after the first copying or second (if I am lucky), the problem happens again. For a few text I have to type it myself, for a paragraph I have to close all opening pdf documents and open again so I could select the paragraph to copy. I ran out of my patience for this, it causes trouble and extra time for me just to copying those texts from pdf documents. Does this problem happen to anyone and do you have a solution for this? I would much appreciate if you could help me out, thank you!Yeah, I totally agree, this is very strange. I have always been using Adobe Reader but this problem only occurred ~three months ago. It must be that some software newly installed I think. But I have no idea.
About your additional question, after selecting the texts and Ctrl + C, the texts are copied and nothing strange happens. It's just that right after I managed to copy the texts, it takes me a while to be able to select the texts again. For your information, I just tested to select the texts and then pressed Ctrl, the problem happened. And then I tried pressing C and then others letters, it all led to the problem.
I guess I have to stick with left-clicked + Copy until I/someone figure the source of this problem. Thanks a lot for your help! -
Problem with: select 'c' as X from dual
Problem with 'select 'c' as X from dual'
I get 2 different results when I execute the above with SQLPlus (or java) depending on the instance I am connected to. For one instance the result is a single character and for the other the character is padded with blanks to 32 chars in the SQLPlus window (and java). Does anyone know what database setting causes this to happen? Is it a version issue ?
Test #1: Oracle 9.2.0.6 - SQLPlus result is padded with blanks
SQL*Plus: Release 9.2.0.1.0 - Production on Mon Dec 10 09:27:58 2007
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
With the Partitioning option
JServer Release 9.2.0.6.0 - Production
SQL> select 'c' as X from dual;
X
c
SQL>
Test #2 Oracle 9.2.0.1 SQLPlus result is a single character.
SQL*Plus: Release 9.2.0.1.0 - Production on Mon Dec 10 09:29:27 2007
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production
SQL> select 'c' as X from dual;
X
c
SQL>Using 9.2.0.6 On AIX 5.2 I get the single byte result:
UT1 > select 'c' as X from dual;
X
c
If the databases are on different Oracle Homes you may want to check the sqlplus global logon files for any set commands.
If you executed the two sql statements from different OS directories you may also want to check your sqlpath for sqlplus .logon files.
Try issueing clear columns and repeating the statement. Are the results the same?
HTH -- Mark D Powell -- -
Problem with select query inside a function.
Hi,
i have created a function as
create or replace function "NEW"
(emp in number,
s_date in DATE,
e_date in DATE)
return number
is
v_alo number default 0;
v_alo2 number default 0;
v_date date;
begin
select sum(allocation_percent) into v_alo from employeeproject where start_date < s_date and end_date > e_date and pid != 'BPDE-KER12' and employee_id = emp;
select allocation_percent into v_alo2 from employeeproject where start_date < s_date and end_date > e_date and pid = 'BPDE-KER12' and employee_id = emp;
select max(end_date) into v_date from employeeproject where employee_id=emp having max(end_date) <= S_DATE;
if v_alo < 100 then
return 1;
else if v_alo2 = 100 then
return 2;
else if v_date < s_date then
return 3;
else
return 4;
end if;
end if;
end if;
exception
when NO_DATA_FOUND then
return 5;
end;it is compiled correctly.
when executing the function with
select abc.a,new(a,'03-jan-2011','04-jan-2011') "status" from abc where new(a,'03-jan-2011','04-jan-2011') in (1,2,3,4);it is returning
A status
1 5
2 5
3 5
instead of
A status
1 1
2 2
3 3
and when i comment any two select statements then some part of my ans is correct.
unable to understand the behaviour.
can any pls help me understand it.
Thanks,
hariHi,
thanks for the reply, and sorry for my ugly code.
i am using Oracle database 10g express edition.
Case could be a option to use but i need to figure why my query is not returning any value when used together.
my requirement is to find
the employees who are have allocation percent sum < 100 for a defined period(excluding pid=BPDE-KER12) and
employee who is mapped to pid=BPDE-KER12 not in my first requirement in that period and
the employees whose latest end date is less than the new start date.
i have tried the new modified code as you said but this time it returns null, not even exceptions running.
i divide my requirement into three functions which will return value.
1. create or replace function "NEW4"
(emp in number,
s_date in DATE,
e_date in DATE)
return number
is
v_alo number default 0;
v_alo2 number default 0;
v_date date;
begin
--to check if the employee total percentage is <100 then return 1 else return 4
select sum(allocation_percent) into v_alo from pm_employee_project
where
start_date < s_date and end_date > e_date and pid !='BPDE-KER12' and employee_id = emp;
if v_alo < 100 then
return 1;
elsif v_alo2 = 100 then
return 2;
elsif v_date < s_date then
return 3;
else
return 4;
end if;
exception
when NO_DATA_FOUND then
return 5;
end;
then,
select abc.a,NEW4(a,'03-jan-2011','30-jan-2011') "STATUS" from abc
result,
A STATUS
1 *1*
2 4
3 4 2.create or replace function "NEW5"
(emp in number,
s_date in DATE,
e_date in DATE)
return number
is
v_alo number default 0;
v_alo2 number default 0;
v_date date;
begin
--To select employee who are in a specific pid.
select allocation_percent into v_alo2 from pm_employee_project where
start_date < s_date and end_date > e_date and pid = 'BPDE-KER12' and
employee_id = emp;
if v_alo2 = 100 then
return 2;
elsif v_alo < 100 then
return 1;
elsif v_date < s_date then
return 3;
else
return 4;
end if;
exception
when NO_DATA_FOUND then
return 5;
end;
then,
select abc.a,NEW5(a,'03-jan-2011','30-jan-2011') "STATUS" from abc
Result,
A STATUS
1 5
2 *2*
3 5 3. create or replace function "NEW6"
(emp in number,
s_date in DATE,
e_date in DATE)
return number
is
v_alo number default 0;
v_alo2 number default 0;
v_date date;
begin
--to select the employee whose project end date is less thann the new date.
select max(end_date) into v_date from pm_employee_project where
employee_id=emp having max(end_date) <= S_DATE;
if v_alo2 = 100 then
return 2;
elsif v_alo = 100 then
return 1;
elsif v_date < s_date then
return 3;
else
return 4;
end if;
exception
when NO_DATA_FOUND then
return 5;
end;
then,
select abc.a,NEW6(a,'03-jan-2011','30-jan-2011') "STATUS" from abc
Result,
A STATUS
1 5
2 5
3 *3* so my function works properly individually, but i want all the three conditions in a single function with same order as above 1 then 2 and then 3.
and when i try to do it that way i am not getting my result as
A STATUS
1 *1*
2 *2*
3 *3*
so how can i proceed.
my input table values,
select * from abc
A B C
1 2 2
2 1 3
3 1 2
select * from pm_employee_project
varchar2 varchar2 date date date varchar2
EMPLOYEE_ID PID START_DATE END_DATE ALLOCATION_PERCENT SUPERVISOR_ID
1 10 02-JAN-11 31-JAN-11 89 -
1 20 05-JAN-11 20-JAN-11 9 -
1 BPDE-KER12 21-JAN-11 31-JAN-11 11 -
2 BPDE-KER12 01-JAN-11 31-JAN-11 100 -
3 30 01-JAN-10 01-JAN-11 100 -
View with columns based on function - problem with query
Hi,
I'm using Oracle 9i;
I've created a view which has columns based on a table columns (multiple columns from 1 table) and funtion (multiple columns based on 1 function).
The function takes ID as the first argument and name of the column to determine which value to return as the second one.
Here is a sample of such function (simplified):
FUNCTION my_function
(in_id IN NUMBER, in_col_name IN VARCHAR2)
RETURN VARCHAR2
IS
c_name VARCHAR2(100);
c_last_name VARCHAR2(100);
BEGIN
SELECT T.NAME, T.LAST_NAME
INTO c_name, c_last_name
FROM TABLE_1 T, TABLE_2 Z
WHERE T.PK = Z.FK
AND Z.ID = in_id;
IF in_col_name = 'NAME' THEN
RETURN c_name;
ELSIF in_col_name = 'LAST_NAME' THEN
RETURN c_last_name;
END IF;
END;
For simplicty I've restricted the number of columns.
CREATE OR REPLACE VIEW my_view
(ID, NAME, LAST_NAME)
AS
SELECT
T.ID ID
,CAST(my_function(T.ID,'NAME') AS VARCHAR2(100)) NAME
,CAST(my_function(T.ID,'LAST_NAME') AS VARCHAR2(100)) LAST_NAME
FROM TABLE T;
There is no problem with query:
SELECT * FROM my_view;
The problem arises when I query the view (regardles of '=' or 'LIKE'):
SELECT * FROM my_view
WHERE name LIKE '%some_part_of_name%'
The query returns rows for same names, for same it doesn't. If I put '=' and the whole name the query returns nothing, but when I put 'LIKE' and the first letter it returns rows in some cases.
I've tried to debug this situation and I've discovered that the function recives ID not in the proper order and not the same amount of times - in explicit:
for each ID in (1, 2, 3, 4, 5, 6, ... , 100) the function should be called twice for each ID and in the same order, but it does not.
I get 1, 1, 2, 3, 3, 6, 20, 20 and so on.
Help needed.
Greetings.The problem is more complicated than the solutions provided here.
The reason why I'm using the function is this:
the original view was constructed using multiple union all selects and the speed was terrible. I've created the index on the base table to obtain a proper sort. For retriving all records at once the view works perfectly, but if one wants to query by columns based on function the results are suprisng - sometimes there are, some times there are none, or if you serch with "like" and only a part of string there are results, but with "=" there are no results.
Here are real DDLs:
View:
CREATE OR REPLACE VIEW V_DOK_ARCH
(ID_ZDAR, TYP, STAN, DATE_CREATED, CREATED_BY,
DATE_MODIFIED, MODIFIED_BY, SPRA_ID_SPRA, PODM_ID_PODM, PODM_UMOW_ID_UMOW,
NR_WFS, WFS_NR_INTER, UWAGI_OPER, FUNDUSZ, NUMER,
DATA_PODPISANIA, RODZAJ, TYP_PRZY, TYP_UBEZ, NAZWISKO,
IMIE, IMIE_OJCA, NAZWA_FIRMY, NAZWA_FIRMY_SKR, DANE_KLIE)
AS
SELECT /*+ INDEX(Z ZDAR_DATE_CREATED_DESC_I) */
Z.ID_ZDAR ID_ZDAR
, Z.TYP TYP
, Z.STAN STAN
, Z.DATE_CREATED DATE_CREATED
, Z.CREATED_BY CREATED_BY
, Z.DATE_MODIFIED DATE_MODIFIED
, Z.MODIFIED_BY MODIFIED_BY
, Z.SPRA_ID_SPRA SPRA_ID_SPRA
, Z.PODM_ID_PODM PODM_ID_PODM
, Z.PODM_UMOW_ID_UMOW PODM_UMOW_ID_UMOW
, Z.NR_WFS NR_WFS
, Z.WFS_NR_INTER WFS_NR_INTER
, Z.UWAGI_OPER UWAGI_OPER
, Z.FUNDUSZ FUNDUSZ
, CAST(F_Rej_Zdar_Char(Z.ID_ZDAR, 'NUMER') AS VARCHAR2(30)) NUMER
, F_Rej_Zdar_Date(Z.ID_ZDAR, 'DATA_PODPISANIA') DATA_PODPISANIA
, CAST(F_Rej_Zdar_Char(Z.ID_ZDAR, 'RODZAJ') AS VARCHAR2(4)) RODZAJ
, CAST(F_Rej_Zdar_Char(Z.ID_ZDAR, 'TYP_PRZY') AS VARCHAR2(4)) TYP_PRZY
, CAST(F_Rej_Zdar_Char(Z.ID_ZDAR, 'TYP_UBEZ') AS VARCHAR2(3)) TYP_UBEZ
, CAST(F_Rej_Zdar_Char(Z.ID_ZDAR, 'NAZWISKO') AS VARCHAR2(30)) NAZWISKO
, CAST(F_Rej_Zdar_Char(Z.ID_ZDAR, 'IMIE') AS VARCHAR2(30)) IMIE
, CAST(F_Rej_Zdar_Char(Z.ID_ZDAR, 'IMIE_OJCA') AS VARCHAR2(30)) IMIE_OJCA
, CAST(F_Rej_Zdar_Char(Z.ID_ZDAR, 'NAZWA_FIRMY') AS VARCHAR2(300)) NAZWA_FIRMY
, CAST(F_Rej_Zdar_Char(Z.ID_ZDAR, 'NAZWA_FIRMY_SKR') AS VARCHAR2(100)) NAZWA_FIRMY_SKR
, CAST(LTRIM(F_Rej_Zdar_Char(Z.ID_ZDAR, 'NAZWISKO')||' '||F_Rej_Zdar_Char(Z.ID_ZDAR, 'IMIE')||' '||F_Rej_Zdar_Char(Z.ID_ZDAR, 'IMIE_OJCA')||F_Rej_Zdar_Char(Z.ID_ZDAR, 'NAZWA_FIRMY')||DECODE(F_Rej_Zdar_Char(Z.ID_ZDAR, 'NAZWA_FIRMY'),NULL,F_Rej_Zdar_Char(Z.ID_ZDAR, 'NAZWA_FIRMY_SKR'),NULL)) AS VARCHAR2(492)) DANE_KLIE
FROM T_ZDARZENIA Z
WHERE F_Rej_Zdar_Char(Z.ID_ZDAR, 'JEST') = 'T';
and functions:
CREATE OR REPLACE FUNCTION F_Rej_Zdar_Char
(WE_ID_ZDAR IN NUMBER
,WE_KOLUMNA IN VARCHAR2
RETURN VARCHAR2
IS
c_numer T_PRZYSTAPIENIA.NUMER%TYPE;--VARCHAR2(30);
c_rodzaj T_KLIENCI.RODZAJ%TYPE;--VARCHAR2(1);
c_typ_przy T_PRZYSTAPIENIA.TYP_PRZY%TYPE;--VARCHAR2(1);
c_typ_ubez T_PRZYSTAPIENIA.TYP_UBEZ%TYPE;--VARCHAR2(3);
c_nazwisko T_KLIENCI.NAZWISKO%TYPE;--VARCHAR2(30);
c_imie T_KLIENCI.IMIE%TYPE;--VARCHAR2(30);
c_imie_ojca T_KLIENCI.IMIE_OJCA%TYPE;--VARCHAR2(30);
c_nazwa_firmy T_KLIENCI.NAZWA_FIRMY%TYPE;--VARCHAR2(300);
c_nazwa_firmy_skr T_KLIENCI.NAZWA_FIRMY%TYPE;--VARCHAR2(100);
c_jest VARCHAR2(1) := 'T';
c EXCEPTION;
BEGIN
--dbms_output.put_line('id zdar wykonania '||WE_ID_ZDAR);
BEGIN
SELECT p.NUMER, k.RODZAJ,p.TYP_PRZY,p.TYP_UBEZ,k.nazwisko, k.imie, k.imie_ojca, k.nazwa_firmy, k.nazwa_firmy_skr
INTO c_numer, c_rodzaj, c_typ_przy, c_typ_ubez, c_nazwisko, c_imie, c_imie_ojca, c_nazwa_firmy, c_nazwa_firmy_skr
FROM T_KLIENCI k, T_PRZYSTAPIENIA p, T_ZDARZENIA z, T_PODMIOTY D1, T_PODMIOTY D2
WHERE p.KLIE_ID_KLIE = k.ID_KLIE
AND z.PODM_ID_PODM = D1.ID_PODM
AND D1.KLIE_ID_KLIE = p.KLIE_ID_KLIE
AND Z.PODM_UMOW_ID_UMOW = D2.ID_PODM
AND D2.PRZY_ID_PRZY = P.ID_PRZY
AND z.ID_ZDAR = WE_ID_ZDAR;
EXCEPTION
WHEN NO_DATA_FOUND THEN
BEGIN
SELECT p.NUMER, k.RODZAJ,p.TYP_PRZY,p.TYP_UBEZ,k.nazwisko, k.imie, k.imie_ojca, k.nazwa_firmy, k.nazwa_firmy_skr
INTO c_numer, c_rodzaj, c_typ_przy, c_typ_ubez, c_nazwisko, c_imie, c_imie_ojca, c_nazwa_firmy, c_nazwa_firmy_skr
FROM T_KLIENCI k, T_PRZYSTAPIENIA p, T_ZDARZENIA z, T_PODMIOTY D
WHERE z.PODM_UMOW_ID_UMOW IS NULL
AND z.PODM_ID_PODM = D.ID_PODM
AND D.KLIE_ID_KLIE = k.ID_KLIE
AND p.KLIE_ID_KLIE = k.ID_KLIE
AND z.ID_ZDAR = WE_ID_ZDAR;
EXCEPTION
WHEN NO_DATA_FOUND THEN
BEGIN
SELECT NULL NUMER, NULL RODZAJ,NULL TYP_PRZY,NULL TYP_UBEZ, I.nazwisko, I.imie, I.imie_ojca, I.NAZWA NAZWA_FIRMY, I.NAZWA_SKR nazwa_firmy_skr
INTO c_numer, c_rodzaj, c_typ_przy, c_typ_ubez, c_nazwisko, c_imie, c_imie_ojca, c_nazwa_firmy, c_nazwa_firmy_skr
FROM T_ZDARZENIA z, T_INSTYTUCJE I
WHERE Z.TYP IN ('WFS526','WFS542','WFS553','WFS609','WFS611','WYP_KS','WYP_PO','WYP_SB','DI_ZAT')
AND z.PODM_UMOW_ID_UMOW IS NULL
AND Z.PODM_ID_PODM = I.ID_INST
AND z.ID_ZDAR = WE_ID_ZDAR;
EXCEPTION
WHEN NO_DATA_FOUND THEN
BEGIN
SELECT p.NUMER NUMER, DECODE(a.TYP_AGENTA,'A','F','P') RODZAJ, DECODE(a.TYP_AGENTA,'P','R',a.TYP_AGENTA) TYP_PRZY,NULL TYP_UBEZ,a.nazwisko, a.imie, a.imie_ojca, a.nazwa_firmy, a.nazwa_firmy_skr
INTO c_numer, c_rodzaj, c_typ_przy, c_typ_ubez, c_nazwisko, c_imie, c_imie_ojca, c_nazwa_firmy, c_nazwa_firmy_skr
FROM T_AG_AGENCI a, T_AG_UMOWY p, T_ZDARZENIA z
WHERE a.ID_AGAG = p.AGAG_ID_AGAG
AND z.PODM_UMOW_ID_UMOW = p.ID_AGUM
AND z.ID_ZDAR = WE_ID_ZDAR;
EXCEPTION
WHEN NO_DATA_FOUND THEN
BEGIN
SELECT p.NUMER NUMER, DECODE(a.TYP_AGENTA,'A','F','P') RODZAJ, DECODE(a.TYP_AGENTA,'P','R',a.TYP_AGENTA) TYP_PRZY,NULL TYP_UBEZ,a.nazwisko, a.imie, a.imie_ojca, a.nazwa_firmy, a.nazwa_firmy_skr
INTO c_numer, c_rodzaj, c_typ_przy, c_typ_ubez, c_nazwisko, c_imie, c_imie_ojca, c_nazwa_firmy, c_nazwa_firmy_skr
FROM T_AG_AGENCI a, T_AG_UMOWY p, T_ZDARZENIA z
WHERE a.ID_AGAG = p.AGAG_ID_AGAG
AND z.PODM_ID_PODM = a.ID_AGAG
AND z.PODM_UMOW_ID_UMOW IS NULL
AND z.ID_ZDAR = WE_ID_ZDAR;
EXCEPTION
WHEN NO_DATA_FOUND THEN
BEGIN
SELECT p.NUMER_UMOWY NUMER, DECODE(p.TYP_AGENTA,'A','F','P') RODZAJ, DECODE(p.TYP_AGENTA,'P','R',p.TYP_AGENTA) TYP_PRZY,NULL TYP_UBEZ,p.nazwisko, p.imie_pierwsze, p.imie_ojca, p.nazwa_firmy, p.nazwa_firmy_skr
INTO c_numer, c_rodzaj, c_typ_przy, c_typ_ubez, c_nazwisko, c_imie, c_imie_ojca, c_nazwa_firmy, c_nazwa_firmy_skr
FROM T_AG_KANDYDACI a, T_AG_UMOWY_TAB p, T_ZDARZENIA z
WHERE a.ID_AGKAN = p.TECH_PODM_ID_PODM
AND z.PODM_UMOW_ID_UMOW = p.TECH_ID_AGUMT
AND z.ID_ZDAR = WE_ID_ZDAR;
EXCEPTION
WHEN NO_DATA_FOUND THEN
BEGIN
SELECT p.NUMER_UMOWY NUMER, DECODE(p.TYP_AGENTA,'A','F','P') RODZAJ, DECODE(p.TYP_AGENTA,'P','R',p.TYP_AGENTA) TYP_PRZY,NULL TYP_UBEZ,p.nazwisko, p.imie_pierwsze, p.imie_ojca, p.nazwa_firmy, p.nazwa_firmy_skr
INTO c_numer, c_rodzaj, c_typ_przy, c_typ_ubez, c_nazwisko, c_imie, c_imie_ojca, c_nazwa_firmy, c_nazwa_firmy_skr
FROM T_AG_KANDYDACI a, T_AG_UMOWY_TAB p, T_ZDARZENIA z
WHERE a.ID_AGKAN = p.TECH_PODM_ID_PODM
AND z.PODM_ID_PODM = a.ID_AGKAN
AND z.PODM_UMOW_ID_UMOW IS NULL
AND z.ID_ZDAR = WE_ID_ZDAR;
EXCEPTION
WHEN NO_DATA_FOUND THEN
BEGIN
SELECT k.NUMER_UMOWY NUMER, DECODE(k.TYP_PRZYSTAPIENIA,'P','F','P') RODZAJ,k.TYP_PRZYSTAPIENIA TYP_PRZY,'NPO' TYP_UBEZ, k.nazwisko, k.imie_pierwsze, k.imie_ojca, k.nazwa_firmy nazwa_firmy, k.nazwa_firmy_skr nazwa_firmy_skr
INTO c_numer, c_rodzaj, c_typ_przy, c_typ_ubez, c_nazwisko, c_imie, c_imie_ojca, c_nazwa_firmy, c_nazwa_firmy_skr
FROM T_WE_UM_NPO_TAB k, T_ZDARZENIA z
WHERE z.ID_ZDAR = k.TECH_ZDAR_ID_ZDAR
AND k.TYP_PRZYSTAPIENIA IN ('P','W')
AND z.PODM_ID_PODM IS NULL
AND z.PODM_UMOW_ID_UMOW IS NULL
AND z.ID_ZDAR = WE_ID_ZDAR;
EXCEPTION
WHEN NO_DATA_FOUND THEN
BEGIN
SELECT k.NUMER_UMOWY NUMER, 'F' RODZAJ,'-' TYP_PRZY,'OPS' TYP_UBEZ, k.nazwisko, k.imie_pierwsze, k.imie_ojca, NULL nazwa_firmy, NULL nazwa_firmy_skr
INTO c_numer, c_rodzaj, c_typ_przy, c_typ_ubez, c_nazwisko, c_imie, c_imie_ojca, c_nazwa_firmy, c_nazwa_firmy_skr
FROM T_WE_UM_OPS_TAB k,T_ZDARZENIA z
WHERE z.ID_ZDAR = k.TECH_ZDAR_ID_ZDAR
AND z.PODM_ID_PODM IS NULL
AND z.PODM_UMOW_ID_UMOW IS NULL
AND z.ID_ZDAR = WE_ID_ZDAR;
EXCEPTION
WHEN NO_DATA_FOUND THEN
BEGIN
SELECT NULL NUMER, NULL RODZAJ,NULL TYP_PRZY,NULL TYP_UBEZ, NULL nazwisko, NULL imie_pierwsze, NULL imie_ojca, NULL nazwa_firmy, NULL nazwa_firmy_skr
INTO c_numer, c_rodzaj, c_typ_przy, c_typ_ubez, c_nazwisko, c_imie, c_imie_ojca, c_nazwa_firmy, c_nazwa_firmy_skr
FROM T_ZDARZENIA z
WHERE z.TYP NOT IN ('UM_OPS','UM_NPO','NPO_OP','UZUP_U')
AND z.PODM_ID_PODM IS NULL
AND z.PODM_UMOW_ID_UMOW IS NULL
AND z.ID_ZDAR = WE_ID_ZDAR;
EXCEPTION
WHEN NO_DATA_FOUND THEN
--dbms_output.put_line('id zdar wykonania '||WE_ID_ZDAR||' ostatni wyjatek');
NULL;
END;
END;
END;
END;
END;
END;
END;
END;
END;
END;
--raise c;
IF WE_KOLUMNA = 'NUMER' THEN
RETURN c_numer;
ELSIF WE_KOLUMNA = 'RODZAJ' THEN
RETURN c_rodzaj;
ELSIF WE_KOLUMNA = 'TYP_PRZY' THEN
RETURN c_typ_przy;
ELSIF WE_KOLUMNA = 'TYP_UBEZ' THEN
RETURN c_typ_ubez;
ELSIF WE_KOLUMNA = 'NAZWISKO' THEN
RETURN c_nazwisko;
ELSIF WE_KOLUMNA = 'IMIE' THEN
RETURN c_imie;
ELSIF WE_KOLUMNA = 'IMIE_OJCA' THEN
RETURN c_imie_ojca;
ELSIF WE_KOLUMNA = 'NAZWA_FIRMY' THEN
RETURN c_nazwa_firmy;
ELSIF WE_KOLUMNA = 'NAZWA_FIRMY_SKR' THEN
RETURN c_nazwa_firmy_skr;
ELSIF WE_KOLUMNA = 'JEST' THEN
RETURN c_jest;
END IF;
END;
CREATE OR REPLACE FUNCTION F_Rej_Zdar_Date
(WE_ID_ZDAR IN NUMBER
,WE_KOLUMNA IN VARCHAR2
RETURN DATE
IS
d_data DATE;
BEGIN
BEGIN
SELECT p.DATA_PODPISANIA
INTO d_data
FROM T_KLIENCI k, T_PRZYSTAPIENIA p, T_ZDARZENIA z, T_PODMIOTY D1, T_PODMIOTY D2
WHERE p.KLIE_ID_KLIE = k.ID_KLIE
AND z.PODM_ID_PODM = D1.ID_PODM
AND D1.KLIE_ID_KLIE = p.KLIE_ID_KLIE
AND Z.PODM_UMOW_ID_UMOW = D2.ID_PODM
AND D2.PRZY_ID_PRZY = P.ID_PRZY
AND z.ID_ZDAR = WE_ID_ZDAR;
EXCEPTION
WHEN NO_DATA_FOUND THEN
BEGIN
SELECT p.DATA_PODPISANIA
INTO d_data
FROM T_KLIENCI k, T_PRZYSTAPIENIA p, T_ZDARZENIA z, T_PODMIOTY D
WHERE z.PODM_UMOW_ID_UMOW IS NULL
AND z.PODM_ID_PODM = D.ID_PODM
AND D.KLIE_ID_KLIE = k.ID_KLIE
AND p.KLIE_ID_KLIE = k.ID_KLIE
AND z.ID_ZDAR = WE_ID_ZDAR;
EXCEPTION
WHEN NO_DATA_FOUND THEN
BEGIN
SELECT NULL DATA_PODPISANIA
INTO d_data
FROM T_ZDARZENIA z, T_INSTYTUCJE I
WHERE Z.TYP IN ('WFS526','WFS542','WFS553','WFS609','WFS611','WYP_KS','WYP_PO','WYP_SB','DI_ZAT')
AND z.PODM_UMOW_ID_UMOW IS NULL
AND Z.PODM_ID_PODM = I.ID_INST
AND z.ID_ZDAR = WE_ID_ZDAR;
EXCEPTION
WHEN NO_DATA_FOUND THEN
BEGIN
SELECT p.DATA_PODPISANIA DATA_PODPISANIA
INTO d_data
FROM T_AG_AGENCI a, T_AG_UMOWY p, T_ZDARZENIA z
WHERE a.ID_AGAG = p.AGAG_ID_AGAG
AND z.PODM_UMOW_ID_UMOW = p.ID_AGUM
AND z.ID_ZDAR = WE_ID_ZDAR;
EXCEPTION
WHEN NO_DATA_FOUND THEN
BEGIN
SELECT p.DATA_PODPISANIA DATA_PODPISANIA
INTO d_data
FROM T_AG_AGENCI a, T_AG_UMOWY p, T_ZDARZENIA z
WHERE a.ID_AGAG = p.AGAG_ID_AGAG
AND z.PODM_ID_PODM = a.ID_AGAG
AND z.PODM_UMOW_ID_UMOW IS NULL
AND z.ID_ZDAR = WE_ID_ZDAR;
EXCEPTION
WHEN NO_DATA_FOUND THEN
BEGIN
SELECT p.DATA_PODPISU_AGENTA DATA_PODPISANIA
INTO d_data
FROM T_AG_KANDYDACI a, T_AG_UMOWY_TAB p, T_ZDARZENIA z
WHERE a.ID_AGKAN = p.TECH_PODM_ID_PODM
AND z.PODM_UMOW_ID_UMOW = p.TECH_ID_AGUMT
AND z.ID_ZDAR = WE_ID_ZDAR;
EXCEPTION
WHEN NO_DATA_FOUND THEN
BEGIN
SELECT p.DATA_PODPISU_AGENTA DATA_PODPISANIA
INTO d_data
FROM T_AG_KANDYDACI a, T_AG_UMOWY_TAB p, T_ZDARZENIA z
WHERE a.ID_AGKAN = p.TECH_PODM_ID_PODM
AND z.PODM_ID_PODM = a.ID_AGKAN
AND z.PODM_UMOW_ID_UMOW IS NULL
AND z.ID_ZDAR = WE_ID_ZDAR;
EXCEPTION
WHEN NO_DATA_FOUND THEN
BEGIN
SELECT k.DATA_PODPISANIA_UM DATA_PODPISANIA
INTO d_data
FROM T_WE_UM_NPO_TAB k, T_ZDARZENIA z
WHERE z.ID_ZDAR = k.TECH_ZDAR_ID_ZDAR
AND k.TYP_PRZYSTAPIENIA IN ('P','W')
AND z.PODM_ID_PODM IS NULL
AND z.PODM_UMOW_ID_UMOW IS NULL
AND z.ID_ZDAR = WE_ID_ZDAR;
EXCEPTION
WHEN NO_DATA_FOUND THEN
BEGIN
SELECT k.DATA_PODPISANIA_UM DATA_PODPISANIA
INTO d_data
FROM T_WE_UM_OPS_TAB k,T_ZDARZENIA z
WHERE z.ID_ZDAR = k.TECH_ZDAR_ID_ZDAR
AND z.PODM_ID_PODM IS NULL
AND z.PODM_UMOW_ID_UMOW IS NULL
AND z.ID_ZDAR = WE_ID_ZDAR;
EXCEPTION
WHEN NO_DATA_FOUND THEN
BEGIN
SELECT NULL DATA_PODPISANIA
INTO d_data
FROM T_ZDARZENIA z
WHERE z.TYP NOT IN ('UM_OPS','UM_NPO','NPO_OP','UZUP_U')
AND z.PODM_ID_PODM IS NULL
AND z.PODM_UMOW_ID_UMOW IS NULL
AND z.ID_ZDAR = WE_ID_ZDAR;
EXCEPTION
WHEN NO_DATA_FOUND THEN
d_data := NULL;
END;
END;
END;
END;
END;
END;
END;
END;
END;
END;
IF WE_KOLUMNA = 'DATA_PODPISANIA' THEN
RETURN d_data;
END IF;
END; -
Problems with "Select Distinct" Statement
Hi... I've a little problem with my SQL Statement...
I've a Table in a DataBase with Solds of the Month... the fields are: vta_fecha, vta_prod, vta_total, vta_mesa.
I've to Select only the distincts fields of vta_prod... selected by vta_fecha and vta_mesa...
My code is like this: try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conec = DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=C:/POOL/Data/BaseDat.MDB");
state = conec.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);try{
rec = state.executeQuery("Select DISTINCT vta_prod, vta_fecha, vta_mesa from Ventas where vta_fecha = #" + Fecha_q + "# And vta_mesa = 0");
rec.first();
int x = 0;
while (rec.isAfterLast()==false){
x++;
rec.next();
rec.first();
if (x > 0){
Productos = new String[x];
Total_Vta = new int[x];
Cant_Prod = new int[x];
x = 0;
while (rec.isAfterLast() == false){
Productos[x] = rec.getString("vta_prod");
rec.next();
x++;
else{
Productos = new String[0];
Total_Vta = new int[0];
Cant_Prod = new int[0];
}catch(Exception e){JOptionPane.showMessageDialog(null,e.getMessage());}Now, in the Table I have only 3 diferents vta_prod, but this Statement returns 9 Rows... and I don't know why...
Please help me...
Regards...I don�t have a complete picture because I don�t know what values you are passing in the select and I don�t know your column types but this is what I think is happening from what you have shared.
You may have misunderstood what the DISTINCT keyword does.
The DISTINCT keyword applies to the full set of columns in the select (not just the first column). So in your case it would be equivalent to:
SELECT vta_prod, vta_fecha, vta_mesa
FROM Ventas
WHERE ...
GROUP BY by vta_prod, vta_fecha, vta_mesa
So, it doesn't matter that you only have 3 distinct vta_prod values if you have multiple values being returned in the other columns. The vta_mesa column can only a return a single value as �0�. That leaves the vta_fecha column which is probably a date/time column and is probably the column that is returning the three other distinct values (one date with three distinct times).
(3 vta_prod) x (3 vta_fecha) x (1 vta_mesa) or 3x3x1 = 9 rows
So find a way to strip the time from vta_fecha in your select statement and your SQL should return the results you expect. I�m not an Access expect but I think I remember you can use something like the �Convert� or �DatePart� functions to make that happen (check your documentation to be sure)..
A couple of asides;
1) You should use a PreparedStatement and rarely if ever use Statement.
2) You should start Java variable names with lower case. -
Problem with selecting text in a PDF document
I'm having a problem with Acrobat 9 and Reader 9. PDF document that has copying and selecting permissions granted, when I highlight text for copying, some of it gets highlighted and some doesn't. Put the same document on several computers in the office, same issue. It's the document, but I can't figure out what the deal is.
We need to copy large portions of this into a new tech manual.
Can someone helpWithout further information, my first reaction is to think that the texts that you cannot copy are included as images.
-
Virtual function problem with SC 4.2
Hi
I'm using SC CC 4.2
[CC -V
CC: WorkShop Compilers 4.2 18 Sep 1997 C++ 4.2 patch 104631-04]
not the latest patch, I realize.
The following bit of code:
ProcessParameters *ppp = &(_config.process_params_);
ppp->save_to_file(String("abc"));
config.processparams_.save_to_file(String("xyz"));
does not work as I'd expect it to!
config.processparams_ is of type ProcessParametersEnhanced,
and the definition of this, and its base class, looks like:
class ProcessParameters
public:
virtual int save_to_file(String filename);
and
class ProcessParametersEnhanced : public ProcessParameters
public:
virtual int save_to_file(String filename);
(I've cut everything else out of the class definitions for clarity, and I've changed the names a bit as well, hopefully without typos).
ppp->save_to_file(String("abc"));
calls ProcessParameters::save_to_file(String)
even though ppp points to an instance of ProcessParametersEnhanced, and the function is virtual.
I've tried building a small test application, using the minimum class interfaces, but this works as I'd expect (it also works fine with gcc).
I'm getting deseperate. Is there a bug in SC4.2 whereby it fails to resolve virtual functions correctly?
TIA
Paul FloydOh well, it was an SC4.2 bug
Patch-ID# 104631-07
Keywords: C++ 4.2 SC4.2
Synopsis: SPARCompiler C++ 4.2: C++ 4.2 patch for Solaris 2.x
Date: Jul/17/98
4066271 C++ has a problem with a copy constructor using virtual and multiple inheritance
It seems as though the copy ctor doesn't copy the vtbl.
Cheers
Paul -
Performance problem with selecting records from BSEG and KONV
Hi,
I am having performance problem while selecting records from BSEG and KONV table. As these two tables have large amount of data , they are taking lot of time . Can anyone help me in improving the performance . Thanks in advance .
Regards,
PrashantHi,
Some steps to improve performance
SOME STEPS USED TO IMPROVE UR PERFORMANCE:
1. Avoid using SELECT...ENDSELECT... construct and use SELECT ... INTO TABLE.
2. Use WHERE clause in your SELECT statement to restrict the volume of data retrieved.
3. Design your Query to Use as much index fields as possible from left to right in your WHERE statement
4. Use FOR ALL ENTRIES in your SELECT statement to retrieve the matching records at one shot.
5. Avoid using nested SELECT statement SELECT within LOOPs.
6. Avoid using INTO CORRESPONDING FIELDS OF TABLE. Instead use INTO TABLE.
7. Avoid using SELECT * and Select only the required fields from the table.
8. Avoid nested loops when working with large internal tables.
9. Use assign instead of into in LOOPs for table types with large work areas
10. When in doubt call transaction SE30 and use the examples and check your code
11. Whenever using READ TABLE use BINARY SEARCH addition to speed up the search. Be sure to sort the internal table before binary search. This is a general thumb rule but typically if you are sure that the data in internal table is less than 200 entries you need not do SORT and use BINARY SEARCH since this is an overhead in performance.
12. Use "CHECK" instead of IF/ENDIF whenever possible.
13. Use "CASE" instead of IF/ENDIF whenever possible.
14. Use "MOVE" with individual variable/field moves instead of "MOVE-
CORRESPONDING" creates more coding but is more effcient. -
I am having trouble in CS6 with selecting a portion of my photo, with any of the tools- quick-selection, lasso or magnetic lasso. What happens is that once I have completed my selection, I get strange rectangles of 'marching ants' throughout my selection. These show up as different colours on the layer mask as well. When I first used quick selection it worked properly.
Is the tool somehow corrupted?Thanks Trevor. It was both. After considering the issue, and using the tool in Elements on my laptop, I decided somehow the tool driver file had been corrupted, and did another install, which thankfully fixed the problem. I'm new to CS6 and was very surprised to have this kind of thing happen. I did a separate backup of my uncorrupted CS6 program files, and plan to do another backup this morning, just to be safe.
Fortunately, it's all good. -
Problem with select query in search
Hi,
Here i am using MYSQL database and when i am insertind date to database it is saving like '2009-11-10 00:00:00' and when i used to dispaly this in dateformat as '11/10/2009' .
here is the problem occurs , when i write a search query as
select recruitername,interviewdate ,skillset
from details
where interviewdate = #form.interviewdate#
i am getting problem with date . would u please help me how to solve this issue .Try to use DateFormat
select recruitername,interviewdate ,skillset
from details
where interviewdate = #DateFormat(form.interviewdate, "yyyy-dd-mm")# -
Problem with select max(FIELD)
I have a table with the following fields:
PARTID ART_TYP AEC SERVICE PLANT STATUS
4711 A A 2 P 230
4711 A B 0 P 230
4712 A B 2 P 230
4713 A B 0 P 230
I need a sqlscript where I get the records with MAX(SERVICE)
In this example
4711 A A 2 P 230
4712 A B 2 P 230
4713 A B 0 P 230
I tried this with:
select distinct partid,
art_typ,
aec,
max(service),
plant,
status
from t_msltmp
group by partid,art_typ,aec,plant,status
But I get both records of partid=4711
Can someone help me with this problem
kind regards
Menk SlotROW_NUMBER() requires explicit ORDER BY clause in OVER:
http://download-uk.oracle.com/docs/cd/B10501_01/server.920/a96540/functions105a.htm#86312
SQL> select partid, art_typ, aec, mx, plant, status
2 from(select partid,
3 art_typ,
4 aec,
5 max(service) over (partition by partid) mx,
6 row_number() over (partition by partid order by service desc) rn
7 plant,
8 status
9 from t_t)
10 where rn = 1
11 /
PARTID A A MX P STATUS
4711 A A 2 P 230
4712 A B 2 P 230
4713 A B 0 P 230Rgds.
P.S.
Another way to get this (more tedoius):
SQL> select partid,
2 max(art_typ) keep (dense_rank first order by service desc) art_typ,
3 max(aec) keep (dense_rank first order by service desc) aec,
4 max(service) service,
5 max(plant) keep (dense_rank first order by service desc) plant,
6 max(status) keep (dense_rank first order by service desc) status
7 from t_t
8 group by partid
9 /
PARTID A A SERVICE P STATUS
4711 A A 2 P 230
4712 A B 2 P 230
4713 A B 0 P 230Message was edited by:
dnikiforov -
I'm having a problem with a SELECT clause...
the variables...
<cfset MyString=#getProducts.matches_with#>
<cfset myArrayList = ListToArray(MyString)>
the query...
SELECT *
FROM pricelist
WHERE supplier_code IN ('#myArrayList[1]#' , '#myArrayList[2]#')
The problem is, the select clause is only ever retrieving one row, despite their being several matches
The clause works fine when I change the WHERE line to
WHERE supplier_code IN ('E1775' , 'R1771')
What am I doing wrong here ?Just wanted to say thanks all for the advice - I'm back on track now.
As you know I had a field 'matches_with' in the merchandise table which contains a comma separated list, which I now accept is bad design.
I wrote the following code to take each field and put it into a new table called matches_with, which contains two fields
product_code , matches_with_product_code. All done.
<cfloop query="getData">
<!--- create an array based on the csv list of items in matches_with field --->
<cfset myArray = ListToArray(#getData.matches_with#)>
<!--- skip if no items in array --->
<cfif #ArrayLen(myArray)# gt 0>
<!--- loop through item in the array --->
<cfloop from="1" to="#ArrayLen(myArray)#" index="i">
<cfquery name="insert" datasource="foo">
<!--- insert each array item into SQL table --->
INSERT INTO 00_matches_with (product_code, matches_with_product_code)
VALUES ('#getData.product_code#' , '#myArray[i]#')
</cfquery>
</cfloop>
</cfif>
</cfloop> -
INVOIC IDOC - E1EDK28 Problem with selection of multiple bank accounts
Hi SAP-Experts!
I have a problem with house banks in outgoing invoice IDOC INVOIC.
We have maintained several house banks in one company code with up to 3 different account ID's.
I was wondering why there is (in my point of view) the wrong bank account populated in one ot the IDOC segments E1EDK28.
What I found out while debugging the code which fills the internal table it012k is, that he selects only the first row from table t012k
(select * from t012k up to 1 rows).
We have already implemented the OSS notes concerning currency dependency and SEPA.
By switching the account ID sequence in sandbox system, e.g. from EUR to SEK, the program picks now the "correct" bank details.
From my Point of view this cannot be a porper logic always to pick the first entry.
Has anyone experienced that issue, too? Is there any solution for this problem (in standard).
If not, I will raise an OSS call at SAP for this.
Thanks for any thoughts!
StefanWhen you enter bank details in master, update field "Partner bank type" LFBK-BVTYP with free form value, may be currency is good choice.
During invoice entry, this field is available for update, update which bank to be used for payment of this invoice. You may build logic to populate this field, like substitution to populate currency in this field during invoice posting.
During payment, system checks value in field Partner bank type in invoice and selects corresponding bank.
Hope this helps.
Maybe you are looking for
-
Report to find Sales orders with shipping type
Hi SD Gurues Im looking for a report that i can use to search out SO with a sertain Shipping type. Our customer center would like to search out all orders going out by SHIP for the next 2 weeks, but there is not an option for this in VL10. I wa swond
-
Missing Administrative Templates in Group Policy Tree.
Few days ago,I found administrative plateform missing which supposed to be listed under GPO.Meanwhile, GPO reports correctly. I did attempt to registy 'gptext.dll' and success following the suggestion, but it didn't work.And it seems the 'gptext.
-
Indesign CS6 installing dynamiclink support very slow
I'm in the process of installing a downloaded version of CS6, and it all seemed to be going well, until it began "installing Adobe dynamiclink support". For about half an hour it has indicated that it is 43% done, according to the progress bar. At fi
-
Iphoto folders and screensaver
Thanks to TD I recovered my library, but now have a bizarre quirk. I have selected an album folder in desktop successfully. I can click on all the albums and the contents are correct in desktop. However when I go to screensaver the SAME albums appear
-
Resolved: Issues connecting iTunes Library between Macs, PC's and Apple TV (1
I was having trouble connecting my wireless Macbook Pro to my wired MacPro on the same network. It turns out that they can see each other fine and even communicate on the ports required: UDP 5353 and TCP 3689. If I took the Macbook Pro and wired it