Problem in join statement
Hi,
I have the following join cond on ekko, ekpo, ekkn tables.
SELECT m~ebeln m~procstat m~rlwrt m~frgke m~bukrs
c~ebelp c~txz01 c~knttp c~netwr
c1~nplnr c1~kostl c1~anln1 c1~sakto c1~prctr c1~aufnr c1~imkey c1~ps_psp_pnr c1~zekkn
FROM ekko AS m INNER JOIN ekpo AS c ON
c~ebeln = m~ebeln
INNER JOIN ekkn AS c1 ON
c1~ebeln = m~ebeln AND
c1~ebelp = c~ebelp
INTO CORRESPONDING FIELDS OF TABLE it_outtab
WHERE m~bukrs IN s_bukrs AND
m~bsart IN s_bsart AND
m~aedat IN s_date AND
m~lifnr IN s_lifnr AND
m~ebeln IN s_ebeln AND
c1~kostl IN s_kostl AND
c1~ps_psp_pnr IN s_posid AND
c1~nplnr IN s_aufnr AND
c1~aufpl IN s_vornr.
Now my problem is whenever there are no enteries in ekpo or ekkn table i'ts not showing those PO's in the final output bcoz I have used inner join logic. But I want those PO'S also. How can i do that.
Thanks,
Change your query like this:
SELECT m~ebeln m~procstat m~rlwrt m~frgke m~bukrs
c~ebelp c~txz01 c~knttp c~netwr
c1~nplnr c1~kostl c1~anln1 c1~sakto c1~prctr c1~aufnr c1~imkey c1~ps_psp_pnr c1~zekkn
FROM ekko AS m LEFT OUTER JOIN ekpo AS c ON " << LEFT OUTER
c~ebeln = m~ebeln
INNER JOIN ekkn AS c1 ON
c1~ebeln = m~ebeln AND
c1~ebelp = c~ebelp
INTO CORRESPONDING FIELDS OF TABLE it_outtab
WHERE m~bukrs IN s_bukrs AND
m~bsart IN s_bsart AND
m~aedat IN s_date AND
m~lifnr IN s_lifnr AND
m~ebeln IN s_ebeln AND
c1~kostl IN s_kostl AND
c1~ps_psp_pnr IN s_posid AND
c1~nplnr IN s_aufnr AND
c1~aufpl IN s_vornr.
Regards,
Naimesh Patel
Similar Messages
-
hay guys
I have written a query in ABAP OO to join 2 tables and have output in different table.Here i want only selected fields in 3 table .I dont know why this query is giving erroe.Help needed.
TYPES : BEGIN OF ty_catsubcat,
CATEGORYID type ZNCYID,
DESCRIPTION_CAT TYPE ZNCYID,
SUBCATID type ZNSBCYID,
DESCRIPTION_SUBCAT type ZNSBDS,
END OF ty_catsubcat.
DATA : IT_CATSUBCAT TYPE TABLE OF ty_catsubcat.
Select ZNCYMS~CATEGORYID ZNCYMS~DESCRIPTION ZNSBCYMS~SUBCATID ZNSBCYMS~DESCRIPTION
INTO (IT_CATSUBCAT-CATEGORYID,
IT_CATSUBCAT-DESCRIPTION_CAT,
IT_CATSUBCAT-SUBCATID,
IT_CATSUBCAT-DESCRIPTION_SUBCAT)
FROM ZNCYMS INNER JOIN ZNSBCYMS
ON ZNCYMS~CATEGORYID = ZNSBCYMS~CATEGORYID
order by ZNCYMS~CATEGORYID.
endselect.A few issues..
Your table it_catsubcat does not have a header line, and you are trying to insert into the header area of the table which does not exist. Either declare a work area/header, or do a table fetch instead.
Select ZNCYMSCATEGORYID ZNCYMSDESCRIPTION ZNSBCYMSSUBCATID ZNSBCYMSDESCRIPTION
<b> INTO CORRESPONDING FIELDS OF TABLE IT_CATSUBCAT</b>
FROM ZNCYMS INNER JOIN ZNSBCYMS
ON ZNCYMSCATEGORYID = ZNSBCYMSCATEGORYID
order by ZNCYMS~CATEGORYID.
If you use a work area to insert into, then you need to append the work area to your internal table.
data: IT_CATSUBCAT TYPE TABLE OF ty_catsubcat with header line.
Select ZNCYMSCATEGORYID ZNCYMSDESCRIPTION ZNSBCYMSSUBCATID ZNSBCYMSDESCRIPTION
INTO (IT_CATSUBCAT-CATEGORYID,
IT_CATSUBCAT-DESCRIPTION_CAT,
IT_CATSUBCAT-SUBCATID,
IT_CATSUBCAT-DESCRIPTION_SUBCAT)
FROM ZNCYMS INNER JOIN ZNSBCYMS
ON ZNCYMSCATEGORYID = ZNSBCYMSCATEGORYID
order by ZNCYMS~CATEGORYID.
append it_catsubcat.
endselect. -
Hi
I am trying to achieve the following in my report:
If an employee has a surname of . (dot) or a first name of . (dot), the report should not display a dot. An employee's name is made up of surname, first name and middle name which should all be concatenated together. To try to achieve this, I have the following statement in my report:
decode(e.Surname, '.', ( LTRIM(RTRIM((INITCAP(e.FIRST_NAME)))||' '||INITCAP(e.MIDDLE_NAME)) ) ,
e.FIRST_NAME, '.', ( LTRIM(RTRIM((INITCAP(e.Surname)))||' '||INITCAP(e.MIDDLE_NAME)) ) ,
( LTRIM(RTRIM((INITCAP(e.SURNAME )))||', '||INITCAP(e.FIRST_NAME)||' '||INITCAP(e.MIDDLE_NAME)) ) ) as emp_name
FROM Employee e
Problem: The above statement is only working for those employees with surname of . (dot). It's not working for first names of dot. How can I use the decode statement OR is there any other way of doing it without using the CASE statement?
It seems my decode statement doesn't work with 2 different fields (surname, firstname) being tested within one decode statement.Thanks.Thank you so much InoL . I have used the ltrim with Replace but now have a new problem.
Because I am joining Surname, First name and middle name together and put a comma after the Surname, the name now appears as follows:
, Maria Ane (if Surname is a dot)
Boiler, (if first name is a dot)
I would like to get rid of a comma and only have comma when surname or first name does not have a dot, i.e. for those people with full names e.g. Blake, Anna Marie.
InoL, how can I achieve this? Thanks. -
Updateable scrollable result sets with join statement
I am writing a generic GUI fronend for any database that has a JDBC2.0 driver available.
I have been using scrollable updateable result sets. These work well for individual tables but as soon as two tables are linked either implicitly or explicitly with a join statement the result set meta data isDefinitelyWriteable is set to false thus preventing the result set from being updated.
Assuming I am using the JDBC-ODBC driver with java sdk1.4.0 and MS Access (although I have used other databases and JDBCs I assume that the one mentioned will be a common combination and needs to work) is there any way of getting linked tables to be updateable with scollable result sets.
I am using scrollable result sets since this prevents the necessity of putting the data in a secondary data store.
I am able to link tables programmatically by requerying the linked table with a new where clause each time the cursor moves in the linked table but this seems rather wasteful. This method is not vey satisfactory when attempting to display data from more than one table which have more than one linked level (i.e. cascaded links).
Is there a simple solution to this problem or do I have to do a rewrite using an update statement instead of having an updateable result set. I assume this method would also require the result set to be reloaded after the update.
Any suggestions much appreciated.I am trying to make the GUI as flexible as possible by constructing "views" which if necessary link tables on one field in each table. This is fine for two tables but when linking to several tables the information thats produced cannot be read easily because as it stands the information from each table is displayed on a separate tabbed page. This mechanism allows me to keep each record set for each table separate and updateable.
Since I could see that this was not very user friendly in the way that it displayed the data I decided to try and introduce a join on two or more tables and hence the introduction of the current problem.
I mentioned that the objective was to be flexible and therefore I also allow queries to be written by the user to facilitate for any shortfalls of the automatic query construction produced by using the "views" mechanism.
So the answer to your question is yes I do control the SQL selections with one mechanism but ultimately no I do not because I provide a fail safe which allows the user to enter arbitary SQL.
I only really want a solution for the controlled SQL construction mechanism where I create the link between two or more tables. As mentioned earlier these are linked on one field only but I wish to provide the option of displaying the result in a single table (tabbed page) rather than spread across multiple tabbed pages. -
AP name is not consistent in APs Join Stats.
hi all,
i have strange issue in my controller (WISM2) AP name is not consistent in APs Join Stats page while the naming is consistent in Wireless status page.as shown below.Thanks,
The problem solved after i cleared the access point from join AP stats. then restart it after that will join with normal name. -
AP 2700 - 2 MAC addresses - problem with joining to the WLC
Hi,
I had a problem with joining my new AP 2700 to the controller. I've found workaround but I would like to ask you if you know if this behavior is a some kind of bug or maybe feature :)
I have DHCP server which assigns IP address base on the binding MAC address with the IP address. Without binding, IP won't be assigned so I added MAC address from the AP sticker (MAC and SN number is on the sticker at the back of each AP) to the DHCP, connected AP to the switch port which was configured exactly the same way like other ports on this switch where older AP are working fine and.... nothing. IP address was not assigned. There was no DHCP request in the DHCP server logs.
During the investigation I've found that AP present 2 MAC addresses on the switch interface:
switch#sh mac address-table interface fa1/1
Mac Address Table
Vlan Mac Address Type Ports
11 58f3.54c1.2cb3 DYNAMIC Fa1/1
11 58f3.54c1.2cb4 DYNAMIC Fa1/1
The first one (58f3.54c1.2cb3) is a "sticker" MAC address but the second one (58f3.54c1.2cb4) is something new. Looking in to the DHCP logs I've found log that this second MAC address (58f3.54c1.2cb4) tried to get IP address but it was not possible because this MAC was not binding with any IP address so DHCP server refuse. I added this second MAC (58f3.54c1.2cb4) to the DHCP server, AP get IP address, join to the WLC, download software, reboot and ... this MAC address disappear.
switch#sh mac address-table interface fa1/1
Mac Address Table
Vlan Mac Address Type Ports
11 58f3.54c1.2cb3 DYNAMIC Fa1/1
Software I had on the AP before joining to the WLC was:
Version :
Cisco IOS Software, C2700 Software (AP3G2-RCVK9W8-M), Version 15.2(4)JB5, RELEASE SOFTWARE (fc1)
now I have (after downloaded from the WLC)
Version :
Cisco IOS Software, C2700 Software (AP3G2-K9W8-M), Version 15.2(4)JB6, RELEASE SOFTWARE (fc1)
Do anyone know what happen?(WLC1) >show sysinfo
Manufacturer's Name.............................. Cisco Systems Inc.
Product Name..................................... Cisco Controller
Product Version.................................. 7.6.130.0
Bootloader Version............................... 1.0.20
Field Recovery Image Version..................... 7.6.95.16
Firmware Version................................. FPGA 1.7, Env 1.8, USB console 2.2
Build Type....................................... DATA + WPS
System Name...................................... WLC1
System Location..................................
System Contact...................................
System ObjectID.................................. 1.3.6.1.4.1.9.1.1069
Redundancy Mode.................................. Disabled
IP Address....................................... 10.10.10.10
Last Reset....................................... Software reset
System Up Time................................... 25 days 2 hrs 53 mins 5 secs
System Timezone Location.........................
System Stats Realtime Interval................... 5
System Stats Normal Interval..................... 180
Configured Country............................... US - United States
Operating Environment............................ Commercial (0 to 40 C)
Internal Temp Alarm Limits....................... 0 to 65 C
Internal Temperature............................. +44 C
External Temperature............................. +22 C
Fan Status....................................... OK
State of 802.11b Network......................... Enabled
State of 802.11a Network......................... Disabled
Number of WLANs.................................. 6
Number of Active Clients......................... 25
Burned-in MAC Address............................ XX:XX:XX:XX:XX:XX
Power Supply 1................................... Present, OK
Power Supply 2................................... Present, OK
Maximum number of APs supported.................. 25
(WLC1) >show time
Time............................................. Thu Apr 9 13:51:00 2015
Timezone delta................................... 0:0
Timezone location................................
NTP Servers
NTP Polling Interval......................... 3600
Index NTP Key Index NTP Server NTP Msg Auth Status
1 0 10.10.10.11 AUTH DISABLED
It's look like AP doesn't allow for console login or commands it just only show activity. After rebooting the WLC I get information:
Cisco IOS Software, C2700 Software (AP3G2-RCVK9W8-M), Version 15.2(4)JB5, RELEASE SOFTWARE (fc1) -
Problem with READ Statement in the field routine of the Transformation
Hi,
I have problem with read statement with binary search in the field routine of the transformation.
read statement is working well when i was checked in the debugging mode, it's not working properly for the bulk load in the background. below are the steps i have implemented in my requirement.
1. I selected the record from the lookuo DSO into one internal table for all entried in source_packeage.
2.i have read same internal table in the field routine for each source_package entry and i am setting the flag for that field .
Code in the start routine
select source accno end_dt acctp from zcam_o11
into table it_zcam
for all entries in source_package
where source = source_package-source
and accno = source_package-accno.
if sy-subrc = 0.
delete it_zcam where acctp <> 3.
delete it_zcam where end_dt initial.
sort it_zcam by surce accno.
endif.
field routine code:
read table it_zcam with key source = source_package-source
accno = source_package-accno
binary search
transportin no fields.
if sy-subrc = 0.
RESULT = 'Y'.
else.
RESULT = 'N'.
endif.
this piece of code exist in the other model there its working fine.when comes to my code it's not working properly, but when i debug the transformation it's working fine for those accno.
the problem is when i do full load the code is not working properly and populating the wrong value in the RESULT field.
this field i am using in the report filter.
please let me know if anybody has the soluton or reason for this strage behaviour.
thanks,
Rahim.i suppose the below is not the actual code. active table of dso would be /bic/azcam_o1100...
1. is the key of zcam_o11 source and accno ?
2. you need to get the sortout of if endif (see code below)
select source accno end_dt acctp from zcam_o11
into table it_zcam
for all entries in source_package
where source = source_package-source
and accno = source_package-accno.
if sy-subrc = 0.
delete it_zcam where acctp 3.
delete it_zcam where end_dt initial.
endif.
sort it_zcam by surce accno.
field routine code:
read table it_zcam with key source = source_package-source
accno = source_package-accno
binary search
transportin no fields.
if sy-subrc = 0.
RESULT = 'Y'.
else.
RESULT = 'N'.
endif. -
I got some problem in update statement.Can anybody discuss with me regarding my problem? Below is the occured problem.
//all the declaration like Connection, ResultSet are declared, setting the ODBC path and so on steps have been set up before this method. When compile it, no error, when I start to run my program, the program�s interface is shown, but the following error was appearred and data cannot be updated, can anybody tell me where is my mistake?
//ERROR:SQL Error in update statement:java.sql.SQLException [Microsoft][ODBC][ODBC Microsoft Access Driver] Syntax Error in UPDATE statement.
//emp_overview is the table name
// last_name, first_name, office_phone�.is the attributes of the table
//this method had declare in the interface class already
public String updateData (String idd, String ln, String fn, String op,
String oe, String hp, String ps, String ss)
throws java.rmi.RemoteException
{//begin of this method
String result ="";
try
Statement statement = connection.createStatement();
String sql = "UPDATE emp_overview SET" +
"last_name=' "+ln+
" ', first_name=' "+fn+
" ', office_phone=' "+op+
" ', office_ext=' "+oe+
" ', home_phone=' "+hp+
" ', primary_skill=' "+ps+
" ', secondary_skill=' "+ss+
" ' WHERE id="+idd;
statement.executeUpdate(sql);
statement.close();
catch (java.sql.SQLException e)
System.out.println("SQL Error in update statement: "+e);
//throw a RemoteException with the exception
//embedded for the client to receive
throw new java.rmi.RemoteException("Error in Updating exist row into DB", e);
return result;
}//end of this methodHi Kevin,
According to the code you have posted, it looks like you are missing a space between "SET" and "last_name". I suggest you add the following line of code:
System.out.println(sql);
before the invocation of "executeUpdate()".
I also suggest you add the following line of code:
e.printStackTrace();in your "catch" block.
Hope this helps.
Good Luck,
Avi. -
Using offset in join statement
hi,
i wanted to use offset in join statement. but it is giving error.
select a~kunnr
a~vkorg
from knvv as inner join zcust
on knvv-kunnr+5(5) = zcust-refid.hi neha,
try this code i tested it.
types: begin of ty_knvv,
INCLUDE type knvv,
kunid type i, " For u type is zcust-refid
end of ty_knvv.
data: it_knvv type STANDARD TABLE OF ty_knvv INITIAL SIZE 0,
wa_knvv type ty_knvv.
select *
from knvv
into table it_knvv.
loop at it_knvv into wa_knvv.
kunid = wa_knvv-kunnr+5(5).
wa_knvv-kunid = kunid.
MOdify it_knvv TRANSPORTING kunid.
read table zcust into wa_zcust with key resid = wa_knvv-kunid.
endloop. -
Problem in Update statement using Execute Immediate
Hi All,
I am facing problem in update statement.
I am creating dynamic sql and use "execute immediate" statement to execute a update statement.
But it is not updating any thing there in the table.
I have created a query like :
update_query='Update '|| Table_Name ||' t set t.process_status =''Y'' where t.tid=:A';
Execute immediate update_query using V_Id;
commit;
But it is not updating the table.
I have a question , is execute immediate only does insert and delete?
Thanks
AshokSQL> select * from t;
TID P
101 N
SQL> declare
2 V_Id number := 101;
3 Table_Name varchar2(30) := 'T';
4 update_query varchar2(1000);
5 begin
6 update_query := 'Update '|| Table_Name ||' t set t.process_status =''Y'' where t.tid=:A';
7 Execute immediate update_query using V_Id;
8 commit;
9 end;
10 /
PL/SQL procedure successfully completed.
SQL> select * from t;
TID P
101 Y -
Problem in UPDATE statement In Multiple Record Block
Hi Friends,
I have problem in update Statement for updating the record in multiple record data Block.
I have two data Block the master block is single Record block and the 2nd data block is Multiple Record data Block.
I am inserting the fields like category,and post_no for partiular job in single data block
Now in second Multiple Record Data Block,i am inserting the multiple record for above fileds like no. of employees work in the position
There is no problem in INSERT Statement as it is inerting all record But whenever i want to update particular Record (in Multiple Block) of employee for that category and Post_no
then its updating all the record.
my code is Bellow,
IF v_count 0 THEN
LOOP
IF :SYSTEM.last_record 'TRUE' THEN
UPDATE post_history
SET idcode = :POST_HISTORY_MULTIPLE.idcode,
joining_post_dt = :POST_HISTORY_MULTIPLE.joining_post_dt,
leaving_post_dt = :POST_HISTORY_MULTIPLE.leaving_post_dt,
entry_gp_stage = :POST_HISTORY_MULTIPLE.entry_gp_stage
WHERE post_no = :POST_HISTORY_SINGLE.post_no
AND category = :POST_HISTORY_SINGLE.category
AND roster_no = :POST_HISTORY_SINGLE.roster_no;
AND idcode = :POST_HISTORY_MULTIPLE.idcode;
IF SQL%NOTFOUND THEN
INSERT INTO post_history(post_no,roster_no,category,idcode,joining_post_dt,leaving_post_dt,entry_gp_stage)
VALUES(g_post_no, g_roster_no, g_category, :POST_HISTORY_MULTIPLE.idcode, :POST_HISTORY_MULTIPLE.joining_post_dt,
:POST_HISTORY_MULTIPLE.leaving_post_dt,:POST_HISTORY_MULTIPLE.entry_gp_stage);
END IF;
next_record;
ELSIF :SYSTEM.last_record = 'TRUE' THEN
UPDATE post_history
SET idcode = :POST_HISTORY_MULTIPLE.idcode,
joining_post_dt = :POST_HISTORY_MULTIPLE.joining_post_dt,
leaving_post_dt = :POST_HISTORY_MULTIPLE.leaving_post_dt,
entry_gp_stage = :POST_HISTORY_MULTIPLE.entry_gp_stage
WHERE post_no = :POST_HISTORY_SINGLE.post_no
AND category = :POST_HISTORY_SINGLE.category
AND roster_no = :POST_HISTORY_SINGLE.roster_no;
AND idcode = :POST_HISTORY_MULTIPLE.idcode;
IF SQL%NOTFOUND THEN
INSERT INTO post_history(post_no,roster_no,category,idcode,joining_post_dt,leaving_post_dt,entry_gp_stage)
VALUES (g_post_no,g_roster_no,g_category,:POST_HISTORY_MULTIPLE.idcode,
:POST_HISTORY_MULTIPLE.joining_post_dt,:POST_HISTORY_MULTIPLE.leaving_post_dt,:POST_HISTORY_MULTIPLE.entry_gp_stage);
END IF;
EXIT;
END IF;
END LOOP;
SET_ALERT_PROPERTY('user_alert',ALERT_MESSAGE_TEXT, 'Record Updated successfuly' );
v_button_no := SHOW_ALERT('user_alert');
FORMS_DDL('COMMIT');
CLEAR_FORM(no_validate);
Please Guide me
Thanks in advenceAs you do a loop over all the records in the block, of course every record is updated.
Also, what you do is not the way is intended to be used. In general, you base a block on a table,then there is no need at all for writing INSERT's or UPDATE's. Forms also know's then, which records to be updated and which not. -
Problem In Update Statement In Multiple Record Data Block
Hi Friends,
I have problem in update Statement for updating the record in multiple record data Block.
I have two data Block the master block is single Record block and the 2nd data block is Multiple Record data Block.
I am inserting the fields like category,and post_no for partiular job in single data block
Now in second Multiple Record Data Block,i am inserting the multiple record for above fileds like no. of employees work in the position
There is no problem in INSERT Statement as it is inerting all record But whenever i want to update particular Record (in Multiple Block) of employee for that category and Post_no
then its updating all the record.
my code is Bellow,
IF v_count <> 0 THEN
LOOP
IF :SYSTEM.last_record <> 'TRUE' THEN
UPDATE post_history
SET idcode = :POST_HISTORY_MULTIPLE.idcode,
joining_post_dt = :POST_HISTORY_MULTIPLE.joining_post_dt,
leaving_post_dt = :POST_HISTORY_MULTIPLE.leaving_post_dt,
entry_gp_stage = :POST_HISTORY_MULTIPLE.entry_gp_stage
WHERE post_no = :POST_HISTORY_SINGLE.post_no
AND category = :POST_HISTORY_SINGLE.category
AND roster_no = :POST_HISTORY_SINGLE.roster_no;
AND idcode = :POST_HISTORY_MULTIPLE.idcode;
IF SQL%NOTFOUND THEN
INSERT INTO post_history(post_no,roster_no,category,idcode,joining_post_dt,leaving_post_dt,entry_gp_stage)
VALUES(g_post_no, g_roster_no, g_category, :POST_HISTORY_MULTIPLE.idcode, :POST_HISTORY_MULTIPLE.joining_post_dt,
:POST_HISTORY_MULTIPLE.leaving_post_dt,:POST_HISTORY_MULTIPLE.entry_gp_stage);
END IF;
next_record;
ELSIF :SYSTEM.last_record = 'TRUE' THEN
UPDATE post_history
SET idcode = :POST_HISTORY_MULTIPLE.idcode,
joining_post_dt = :POST_HISTORY_MULTIPLE.joining_post_dt,
leaving_post_dt = :POST_HISTORY_MULTIPLE.leaving_post_dt,
entry_gp_stage = :POST_HISTORY_MULTIPLE.entry_gp_stage
WHERE post_no = :POST_HISTORY_SINGLE.post_no
AND category = :POST_HISTORY_SINGLE.category
AND roster_no = :POST_HISTORY_SINGLE.roster_no;
AND idcode = :POST_HISTORY_MULTIPLE.idcode;
IF SQL%NOTFOUND THEN
INSERT INTO post_history(post_no,roster_no,category,idcode,joining_post_dt,leaving_post_dt,entry_gp_stage)
VALUES (g_post_no,g_roster_no,g_category,:POST_HISTORY_MULTIPLE.idcode,
:POST_HISTORY_MULTIPLE.joining_post_dt,:POST_HISTORY_MULTIPLE.leaving_post_dt,:POST_HISTORY_MULTIPLE.entry_gp_stage);
END IF;
EXIT;
END IF;
END LOOP;
SET_ALERT_PROPERTY('user_alert',ALERT_MESSAGE_TEXT, 'Record Updated successfuly' );
v_button_no := SHOW_ALERT('user_alert');
FORMS_DDL('COMMIT');
CLEAR_FORM(no_validate);
Please Guide me
Thanks in advenceUPDATE post_history
SET idcode = :POST_HISTORY_MULTIPLE.idcode,
joining_post_dt = :POST_HISTORY_MULTIPLE.joining_post_dt,
leaving_post_dt = :POST_HISTORY_MULTIPLE.leaving_post_dt,
entry_gp_stage = :POST_HISTORY_MULTIPLE.entry_gp_stage
WHERE post_no = :POST_HISTORY_SINGLE.post_no
AND category = :POST_HISTORY_SINGLE.category
AND roster_no = :POST_HISTORY_SINGLE.roster_no;
AND idcode = :POST_HISTORY_MULTIPLE.idcode;
UPDATE post_history
SET idcode = :POST_HISTORY_MULTIPLE.idcode,
joining_post_dt = :POST_HISTORY_MULTIPLE.joining_post_dt,
leaving_post_dt = :POST_HISTORY_MULTIPLE.leaving_post_dt,
entry_gp_stage = :POST_HISTORY_MULTIPLE.entry_gp_stage
WHERE post_no = :POST_HISTORY_SINGLE.post_no
AND category = :POST_HISTORY_SINGLE.category
AND roster_no = :POST_HISTORY_SINGLE.roster_no;
AND idcode = :POST_HISTORY_MULTIPLE.idcode;These update statements are without where clause, so it will update all records.
If it is specific to oracle forms then u may get better help at Forms section. -
Problem in join with hrp1000 and hrp1001???
Hi all, I am pasting code sAmpLE, i am having problem with join, without join the query is working. Help out.
IF per_no IS NOT INITIAL.
SELECT objid sobid objid INTO TABLE lt_st_p1
FROM hrp1001 WHERE otype EQ 'P' AND objid IN per_no
AND plvar EQ lv_plan_version AND rsign EQ 'B' AND relat EQ '008' AND istat EQ '1'
AND subty EQ 'B008' AND sclas EQ 'S'.
LOOP AT lt_st_p1 INTO ls_st_p1_tem.
ls_st_p1_tem-sobid1 = ls_st_p1_tem-pernr.
MODIFY lt_st_p1 FROM ls_st_p1_tem TRANSPORTING sobid1.
ENDLOOP.
check lt_st_p1 is not INITIAL.
SELECT h1objid h1sobid h0~stext INTO TABLE lt_st_p1_temp
FROM hrp1001 AS h1 JOIN hrp1000 as h0 on ( h1objid eq h0objid and h1rsign eq h0otype )
FOR ALL ENTRIES IN lt_st_p1
WHERE h1otype EQ 'O' AND h1sobid = lt_st_p1-sobid
AND h1plvar EQ lv_plan_version AND h1relat EQ '003'
AND h1rsign EQ 'B' AND h1istat EQ '1' AND h1subty EQ 'B003' AND h1sclas EQ 'S'
I want to get the stext of the braNCH. THE lt_st_p1 is having the emp id and position. and i want to get branch , position and stext( of branch) in lt_st_p1_temp by the help of join. I am implementing this qauery, but is getting subrc 4, what is the problem in this , please rectifuy if any problem found ?You may want to change:
check lt_st_p1 is not INITIAL.
to
check lt_st_p1[] is not INITIAL.
This depends on whether or not the internal table was defined with a header line.
Rob
Edited by: Rob Burbank on Jan 2, 2012 2:45 PM -
Hi All,
Here I am facing the problem in Joining table I have S031,s032,makt,marc,I need a field ATWRT field from CAWN table,I did't find any link for this above from tables, any one please help me how to find out.
REPORT ZMMTEST.
tables:s031,s032,makt,marc.
DATA : BEGIN OF itab1 OCCURS 0,
matnr TYPE s031-matnr,
lgort TYPE s031-lgort,
werks TYPE s031-werks,
spmon TYPE s031-spmon,
magbb type S031-magbb,
wagbb type S031-wagbb,
azubb type S031-azubb,
aagbb type S031-aagbb,
END OF itab1.
DATA : BEGIN OF itab2 OCCURS 0,
matnr like makt-matnr,
maktx like makt-maktx,
END OF itab2.
DATA : BEGIN OF itab3 OCCURS 0,
matnr TYPE marc-matnr,
werks type marc-werks,
ekgrp type marc-ekgrp,
END OF itab3.
DATA : BEGIN OF itab4 OCCURS 0 ,
matnr TYPE s032-matnr,
lgort TYPE s032-lgort,
werks TYPE s032-werks,
mbwbest type s032-mbwbest,
wbwbest type s032-wbwbest,
END OF itab4.
data : begin of itab5 occurs 0,
objek type ausp-objek,
atwrt type cawn-atwrt,
end of itab5.
DATA : BEGIN OF itab_final1 OCCURS 0,
matnr TYPE s031-matnr,
lgort TYPE s031-lgort,
werks TYPE s031-werks,
spmon TYPE s031-spmon,
magbb type S031-magbb,
wagbb type S031-wagbb,
azubb type S031-azubb,
aagbb type S031-aagbb,
maktx TYPE makt-maktx,
ekgrp type marc-ekgrp,
mbwbest type s032-mbwbest,
wbwbest type s032-wbwbest,
END OF itab_final1.
DATA : BEGIN OF itab_final OCCURS 0,
matnr TYPE s031-matnr,
lgort TYPE s031-lgort,
werks TYPE s031-werks,
spmon TYPE s031-spmon,
magbb type S031-magbb,
wagbb type S031-wagbb,
azubb type S031-azubb,
aagbb type S031-aagbb,
maktx TYPE makt-maktx,
ekgrp type marc-ekgrp,
mbwbest type s032-mbwbest,
wbwbest type s032-wbwbest,
atwrt type cawn-atwrt,
END OF itab_final.
select-options:s_matnr for s031-matnr.
start-of-selection.
select matnr lgort werks spmon magbb wagbb azubb aagbb
from s031 into table itab1
where matnr in s_matnr.
if not itab1[] is initial.
select matnr maktx from makt into table itab2 for all entries in itab1 where matnr = itab1-matnr.
if not itab2[] is initial.
select matnr werks ekgrp from marc into table itab3 for all entries in itab2 where matnr = itab2-matnr.
if not itab3[] is initial.
select matnr werks mbwbest wbwbest from s032 into corresponding fields of table itab4 for all entries in itab3 where matnr = itab3-matnr.
*if not itab4[] is initial.
select atwrt from cawn into corresponding fields of table itab5.*
endif.
endif.
endif.
endif.
end-of-selection.
loop at itab3.
itab_final-matnr = itab3-matnr.
read table itab2 with key matnr = itab3-matnr.
if sy-subrc = 0.
itab_final-maktx = itab2-maktx.
read table itab1 with key matnr = itab2-matnr.
if sy-subrc = 0.
itab_final-lgort = itab1-lgort.
itab_final-werks = itab1-werks.
itab_final-spmon = itab1-spmon.
itab_final-magbb = itab1-magbb.
itab_final-wagbb = itab1-wagbb.
itab_final-azubb = itab1-azubb.
itab_final-aagbb = itab1-aagbb.
endif.
endif.
itab_final-ekgrp = itab3-ekgrp.
read table itab4 with key matnr = itab3-matnr.
if sy-subrc = 0.
itab_final-mbwbest = itab4-mbwbest.
endif.
itab_final-wbwbest = itab4-wbwbest.
append itab_final.
clear itab_final.
endloop.
WRITE: /2 'material', 23 'storagelocation',29 'plant',35 'date',44 'val.stock.issue',66 'val.stock.issue.value',86 'no.of.stock.receipts',97 'no.of.stock.issues',150 'material.des', 160 'pur.group',190 'stock.val',210 'stock.quan'.
ULINE.
loop at itab_final.
WRITE: /2 itab_final-matnr, 23 itab_final-lgort,29 itab_final-werks,35 itab_final-spmon,44 itab_final-magbb,66 itab_final-wagbb,86 itab_final-azubb,97 itab_final-aagbb,
150 itab_final-maktx, 160 itab_final-ekgrp,190 itab_final-wbwbest,210 itab_final-mbwbest,itab_final-atwrt.
ENDLOOP.
Thanks®ds,
Sree.Hi sree,
take join between s031-sptag ,ausp-datuvthen fetch records based on this condition.(itab1)
After retrieve records based on join condition between
ausp-atinn,ausp-adzhl and cawn-atinn,cawn-adzhl.(itab2)
Retrieve records using for all entries bet first join condition and second join condition.
use for all entries between itab1 and itab2.
it will work surely.
reaward points -
Query based on "NATURAL JOIN" statement of Oracle9i
I have created following 4 tables
create table CUST_MASTER
(CUST_NO NUMBER(3),CUST_NAME VARCHAR2(20),CUST_CITY VARCHAR2(20));
create table ITEM_MASTER
(ITEM_NO NUMBER(2),ITEM_NAME VARCHAR2(20),
PRICE NUMBER(4));
create table ORDER_HEADER
( ORDER_NO NUMBER(4), CUST_NO NUMBER(3));
create table ORDER_ITEMS
( ORDER_NO NUMBER(4), ITEM_NO NUMBER(2), QTY NUMBER(3));
Based on the above 4 table I have executed the following query.
select c.cust_no, c.cust_name, c.cust_city, oh.order_no, i.item_no, i.item_name, i.price, oi.qty
from cust_master c, item_master i, order_header oh, order_items oi
where c.cust_no = oh.cust_no and oh.order_no = oi.order_no and oi.item_no = i.item_no;
How should I build similar query in Oracle9i making use of "NATURAL JOIN" statement?Hallo,
yes you are correct.
From SQL Reference
NATURAL JOIN The NATURAL keyword indicates that a natural join is being performed. A natural join is based on all columns in the two tables that have the same name. It selects rows from the two tables that have equal values in the relevant columns
Nothing about foreign keys.
Test:
select * from scott.emp natural join scott.dept
DEPTNO EMPNO ENAME JOB MGR HIREDATE SAL COMM DNAME LOC
20 7369 SMITH CLERK 7902 17.12.1980 800 RESEARCH DALLAS
30 7499 ALLEN SALESMAN 7698 20.02.1981 1600 300 SALES CHICAGO
30 7521 WARD SALESMAN 7698 22.02.1981 1250 500 SALES CHICAGO
20 7566 JONES MANAGER 7839 02.04.1981 2975 RESEARCH DALLAS
30 7654 MARTIN SALESMAN 7698 28.09.1981 1250 1400 SALES CHICAGO
30 7698 BLAKE MANAGER 7839 01.05.1981 2850 SALES CHICAGO
10 7782 CLARK MANAGER 7839 09.06.1981 2450 ACCOUNTING NEW YORK
20 7788 SCOTT ANALYST 7566 19.04.1987 3000 RESEARCH DALLAS
10 7839 KING PRESIDENT 17.11.1981 5000 ACCOUNTING NEW YORK
30 7844 TURNER SALESMAN 7698 08.09.1981 1500 0 SALES CHICAGO
20 7876 ADAMS CLERK 7788 23.05.1987 1100 RESEARCH DALLAS
30 7900 JAMES CLERK 7698 03.12.1981 950 SALES CHICAGO
20 7902 FORD ANALYST 7566 03.12.1981 3000 RESEARCH DALLAS
10 7934 MILLER CLERK 7782 23.01.1982 1300 ACCOUNTING NEW YORK
alter table scott.emp drop constraint fk_deptno
select * from scott.emp natural join scott.dept
DEPTNO EMPNO ENAME JOB MGR HIREDATE SAL COMM DNAME LOC
20 7369 SMITH CLERK 7902 17.12.1980 800 RESEARCH DALLAS
30 7499 ALLEN SALESMAN 7698 20.02.1981 1600 300 SALES CHICAGO
30 7521 WARD SALESMAN 7698 22.02.1981 1250 500 SALES CHICAGO
20 7566 JONES MANAGER 7839 02.04.1981 2975 RESEARCH DALLAS
30 7654 MARTIN SALESMAN 7698 28.09.1981 1250 1400 SALES CHICAGO
30 7698 BLAKE MANAGER 7839 01.05.1981 2850 SALES CHICAGO
10 7782 CLARK MANAGER 7839 09.06.1981 2450 ACCOUNTING NEW YORK
20 7788 SCOTT ANALYST 7566 19.04.1987 3000 RESEARCH DALLAS
10 7839 KING PRESIDENT 17.11.1981 5000 ACCOUNTING NEW YORK
30 7844 TURNER SALESMAN 7698 08.09.1981 1500 0 SALES CHICAGO
20 7876 ADAMS CLERK 7788 23.05.1987 1100 RESEARCH DALLAS
30 7900 JAMES CLERK 7698 03.12.1981 950 SALES CHICAGO
20 7902 FORD ANALYST 7566 03.12.1981 3000 RESEARCH DALLAS
10 7934 MILLER CLERK 7782 23.01.1982 1300 ACCOUNTING NEW YORK
ALTER TABLE scott.emp
ADD CONSTRAINT fk_deptno FOREIGN KEY (deptno)
REFERENCES SCOTT.dept (deptno)
ENABLE NOVALIDATE
/Regards
Dmytro Dekhtyaryuk
Maybe you are looking for
-
ORACLE instance terminated. Disconnection forced
Hi, When I am trying to login , it is throwing "ORACLE instance terminated. Disconnection forced" Below is the message logged in ALERT Log Completed: ALTER ROLLBACK SEGMENT RBSL1 OFFLINE Sun Jun 23 00:42:35 2013 Errors in file D:\HA_salesupp\Dump_fil
-
Solaris 10 (6/06 SPARC) - Network install
Hello all :) I downloaded the newest ISO, burned it. and tryed to execute the setup_install_server. it tries to find Boot directory (its linked to Boot -> ../../../s1) but the link is broken. in the X86 installation the link exists and not broken so
-
How to pass complex data type structure to WebService under mx:request?
From my Flex client, I need to pass data to a web service whose operation expects a complex data type with multiple layers of nesting structure. How can I populate the <mx:request> for the <mx:WebServices>? Any examples? A couple of approaches come t
-
Skype for Business & Lync Basic 2013 crashing when go to message someone.
Hi, I have been trying to sort this out for a couple of weeks now. What happens is when I go to message someone in the client it crashes straight away and then goes to windows error reporting. The only information in the event viewer is the following
-
Puzzled by Default Page Template value
I am looking at the 11.1.1.4 Spaces VM trying to understand how the product works. On the Configuration tab of the Administration page, in the Resources section, the Default Page Template value is "gsr15fd08a7_5f0f_4f6e_9150_2a7eb8b5fb7a". When I loo