How to delete the data in a table using function
hi all,
i need to delete the data in a table using four parameters in a function,
the parameters are passed through shell script.
How to write the function
Thanks
>
But the only thing is that such function cannot be used in SQL.
>
Perhaps you weren't including the use of autonomous transactions?
CREATE OR REPLACE FUNCTION remove_emp (employee_id NUMBER) RETURN NUMBER AS
PRAGMA AUTONOMOUS_TRANSACTION;
tot_emps NUMBER;
BEGIN
SELECT COUNT(*) INTO TOT_EMPS FROM EMP3;
DELETE FROM emp3
WHERE empno = employee_id;
COMMIT;
tot_emps := tot_emps - 1;
RETURN TOT_EMPS;
END;
SQL> SELECT REMOVE_EMP(7499) FROM DUAL;
REMOVE_EMP(7499)
12
SQL> SELECT REMOVE_EMP(7521) FROM DUAL;
REMOVE_EMP(7521)
11
SQL> SELECT REMOVE_EMP(7566) FROM DUAL;
REMOVE_EMP(7566)
10
SQL>
Similar Messages
-
How to delete the data from partition table
Hi all,
Am very new to partition concepts in oracle..
here my question is how to delete the data from partition table.
is the below query will work ?
delete from table1 partition (P_2008_1212)
we have define range partition ...
or help me how to delete the data from partition table.
Thanks
Sree874823 wrote:
delete from table1 partition (P_2008_1212)This approach is wrong - as Andre pointed, this is not how partition tables should be used.
Oracle supports different structures for data and indexes. A table can be a hash table or index organised table. It can have B+tree index. It can have bitmap indexes. It can be partitioned. Etc.
How the table implements its structure is a physical design consideration.
Application code should only deal with the logical data structure. How that data structure is physically implemented has no bearing on application. Does your application need to know what the indexes are and the names of the indexes,in order to use a table? Obviously not. So why then does your application need to know that the table is partitioned?
When your application code starts referring directly to physical partitions, it needs to know HOW the table is partitioned. It needs to know WHAT partitions to use. It needs to know the names of the partitions. Etc.
And why? All this means is increased complexity in application code as this code now needs to know and understand the physical data structure. This app code is now more complex, has more moving parts, will have more bugs, and will be more complex to maintain.
Oracle can take an app SQL and it can determine (based on the predicates of the SQL), which partitions to use and not use for executing that SQL. All done totally transparently. The app does not need to know that the table is even partitioned.
This is a crucial concept to understand and get right. -
How to update the data in sqlserver table using procedure in biztalkserver
Hi,
Please can any one answer this below question
how to update the data in sqlserver table using procedure in biztalkserver
while am using executescalar,typedprocedure getting some warning
Warning:The adapter failed to transmit message going to send port "SendtoSql1" with URL "mssql://nal126//MU_Stage2?". It will be retransmitted after the retry interval specified for this Send Port. Details
Please send me asap....
Thanks...Hi Messip,
A detailed error would have helped us to answer you more appropriately but
You can follow the post which has step by step instructions, to understand how to use Stored Procedure:
http://tech-findings.blogspot.in/2013/07/insert-records-in-sql-server-using-wcf.html
Maheshkumar
S Tiwari|User
Page|Blog|BizTalk
2013: Inserting RawXML (Whole Incoming XML Message) in SQL database -
How to delete the data from KNVP without using the delete statement
Hello friends,
I have a requirement that I have to delete the data from KNVP table without using any delete statement. For it I have to use the Standard BAPI or any standard program.
Can you please tell me the name of the standard program or BAPI to delete the data .
Thanks in Advance
KuldeepHello Raymond,
I have use the function 'CUSTOMER_UPDATE' in which I only gives the data in T_XKNVP table only but still the data is not get deleting. Please see the code below.
=============================================================
REPORT ZK_TEST2 .
data :
I_KNA1 LIKE KNA1,
I_KNB1 LIKE KNB1,
I_KNVV LIKE KNVV,
I_YKNA1 LIKE KNA1,
I_YKNB1 LIKE KNB1.
Data :
T_XKNAS LIKE FKNAS occurs 0,
T_XKNB5 LIKE FKNB5 occurs 0,
T_XKNBK LIKE FKNBK occurs 0,
T_XKNVA LIKE FKNVA occurs 0,
T_XKNVD LIKE FKNVD occurs 0,
T_XKNVI LIKE FKNVI occurs 0,
T_XKNVK LIKE FKNVK occurs 0,
T_XKNVL LIKE FKNVL occurs 0,
T_XKNVP LIKE FKNVP occurs 0 with header line,
T_XKNVS LIKE FKNVS occurs 0,
T_XKNEX LIKE FKNEX occurs 0,
T_XKNZA LIKE FKNZA occurs 0,
T_YKNAS LIKE FKNAS occurs 0,
T_YKNB5 LIKE FKNB5 occurs 0,
T_YKNBK LIKE FKNBK occurs 0,
T_YKNVA LIKE FKNVA occurs 0,
T_YKNVD LIKE FKNVD occurs 0,
T_YKNVI LIKE FKNVI occurs 0,
T_YKNVK LIKE FKNVK occurs 0,
T_YKNVL LIKE FKNVL occurs 0,
T_YKNVP LIKE FKNVP occurs 0 with header line,
T_YKNVS LIKE FKNVS occurs 0,
T_YKNEX LIKE FKNEX occurs 0,
T_YKNZA LIKE FKNZA occurs 0.
T_XKNVP-KUNNR = '7000002648' .
*T_XKNVP-VKORG = '0001' .
*T_XKNVP-VTWEG = '01' .
*T_XKNVP-SPART = '01' .
T_XKNVP-KZ = 'D' .
append T_XKNVP to T_XKNVP.
CALL FUNCTION 'CUSTOMER_UPDATE'
EXPORTING
I_KNA1 = I_KNA1
I_KNB1 = I_KNB1
I_KNVV = I_KNVV
I_YKNA1 = I_YKNA1
I_YKNB1 = I_YKNB1
TABLES
T_XKNAS = T_XKNAS
T_XKNB5 = T_XKNB5
T_XKNBK = T_XKNBK
T_XKNVA = T_XKNVA
T_XKNVD = T_XKNVD
T_XKNVI = T_XKNVI
T_XKNVK = T_XKNVK
T_XKNVL = T_XKNVL
T_XKNVP = T_XKNVP
T_XKNVS = T_XKNVS
T_XKNEX = T_XKNEX
T_XKNZA = T_XKNZA
T_YKNAS = T_YKNAS
T_YKNB5 = T_YKNB5
T_YKNBK = T_YKNBK
T_YKNVA = T_YKNVA
T_YKNVD = T_YKNVD
T_YKNVI = T_YKNVI
T_YKNVK = T_YKNVK
T_YKNVL = T_YKNVL
T_YKNVP = T_YKNVP
T_YKNVS = T_YKNVS
T_YKNEX = T_YKNEX
T_YKNZA = T_YKNZA
============================================================= -
Regarding how to delete the record in internal table
Hi experts ,
how to delete the record in intarnal table after validating the data,
if record contains invalid fields?
i am giving my code see this and give me the answer?
loop at it_data into wa_data .
Validate Cost Center
READ TABLE it_kostl INTO wa_kostl WITH KEY kostl = wa_data-kostl BINARY SEARCH.
IF sy-subrc NE 0.
PERFORM update_error_log USING wa_data
text-004.
ENDIF.
Validate source file material ( material number )
loop at it_mara into wa_mara .
read table it_ausp into wa_ausp with key atwrt = wa_data-i_matnr .
if sy-subrc NE 0 .
PERFORM update_error_log USING wa_data
text-002.
delete it_data-objek .
else.
read table it_mara into wa_mara with key matnr = wa_ausp-objek .
if sy-subrc EQ 0 .
wa_data-objek = wa_mara-matnr.
wa_data-matkl = wa_mara-matkl.
ENDIF.
Modify it_data from wa_data .
endif.
*endloop.
Validate unit of measure (unit)
READ TABLE it_t006 INTO wa_t006 WITH KEY msehi = wa_data-unit .
IF sy-subrc NE 0.
PERFORM update_error_log USING wa_data
text-003.
endif.
Validate delivery location ( storage location )
READ TABLE it_lgort INTO wa_lgort WITH KEY del_loc = wa_data-del_loc.
IF sy-subrc NE 0.
PERFORM update_error_log USING wa_data
text-001.
if wa_data-flag ='x' .
delete it_data from wa_data .
endif.
ENDIF.
endloop.Hi Naren,
First get the index number of the IT_data table and store it in one variable whose declaration like this.
data: tabix type sy-tabix.
while reading the internal table it_data set the tabix variable.
tabix = sy-tabix.
Instead of the above use below one.
Delete it_data-objek
Use the Below statement it will delete the row from the internal table.
Delete it_data-objek index tabix
Thanks,
Chidanand -
How to delete some date in target table at a mapping?
How to delete some date in target table at a mapping?
I extract date from source tabel into target table,
but before extract date I want to delete some date from target?
how to do?Just to change a bit of terminology in the reply, within the mapping, click on operator properties and choose TRUNCATE/INSERT.
Note that truncate is dependent on constraints, so you probably must disable those before doing this. You can of course do DELETE/INSERT...
Jean-Pierre -
How to get the data from Pooled Table T157E.
Hi Experts,
How to get the data from Pooled Table T157E.
Any help.
Thanks in Advance,
Ur's Harsha.create some internal table similar to T157E and pass all data as per SPRAS.
After that use internal table in your program as per the requirement.
Regds,
Anil -
How to hide the data in particular table in oracle 10g
How to hide the data in particular table in oracle 10g
i want stepsIf its on Report u can always hide the column - Keyfigure or Selection - Display - Hide......y do u want to have it on the report if it is to be hided in the first place?
-
Hi,
Iam new to the xml,
can u please anyone help me how to write procedure to load the data into a table using xml as input parameter to a procedure and xml file is as shown below which is input to me.
<?xml version="1.0"?>
<DiseaseCodes>
<Entity><dcode>0</dcode><ddesc>(I87)Other disorders of veins - postphlebitic syndrome</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
<Entity><dcode>0</dcode><ddesc>(J04)Acute laryngitis and tracheitis</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
<Entity><dcode>0</dcode><ddesc>(J17*)Pneumonia in other diseases - whooping cough</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
</DiseaseCodes>.
Regards,
vikram.here is the your XML parse in 11g :
select *
from xmltable('//Entity' passing xmltype
'<?xml version="1.0"?>
<DiseaseCodes>
<Entity><dcode>0</dcode><ddesc>(I87)Other disorders of veins - postphlebitic syndrome</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
<Entity><dcode>0</dcode><ddesc>(J04)Acute laryngitis and tracheitis</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
<Entity><dcode>0</dcode><ddesc>(J17*)Pneumonia in other diseases - whooping cough</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
</DiseaseCodes>
') columns
"dcode" varchar2(4000) path '/Entity/dcode',
"ddesc" varchar2(4000) path '/Entity/ddesc',
"reauthflag" varchar2(4000) path '/Entity/reauthflag'
dcode ddesc reauthflag
0 (I87)Other disorders of veins - postphlebitic syndrome 0
0 (J04)Acute laryngitis and tracheitis 0
0 (J17*)Pneumonia in other diseases - whooping cough 0
SQL>
Using this parser you can create procedure as
SQL> create or replace procedure myXMLParse(x clob) as
2 begin
3 insert into MyXmlTable
4 select *
5 from xmltable('//Entity' passing xmltype(x) columns "dcode"
6 varchar2(4000) path '/Entity/dcode',
7 "ddesc" varchar2(4000) path '/Entity/ddesc',
8 "reauthflag" varchar2(4000) path '/Entity/reauthflag');
9 commit;
10 end;
11
12 /
Procedure created
SQL>
SQL>
SQL> exec myXMLParse('<?xml version="1.0"?><DiseaseCodes><Entity><dcode>0</dcode><ddesc>(I87)Other disorders of veins - postphlebitic syndrome</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity><Entity><dcode>0</dcode><ddesc>(J04)Acute laryngitis and tracheitis</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity><Entity><dcode>0</dcode><ddesc>(J17*)Pneumonia in other diseases - whooping cough</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity></DiseaseCodes>');
PL/SQL procedure successfully completed
SQL> select * from MYXMLTABLE;
dcode ddesc reauthflag
0 (I87)Other disorders of veins - postphlebitic syndrome 0
0 (J04)Acute laryngitis and tracheitis 0
0 (J17*)Pneumonia in other diseases - whooping cough 0
SQL>
SQL>
Ramin Hashimzade -
How to move the data of a table from sqlplus to XML file
Hi,
Could you pls guide me how to move the data of a table from sqlplus to XML file.
i want to do it from sqlplus rather than toad.pls help
ThanksOh..I'm in 9i.
Try this out..and let me know.
DECLARE
CTX DBMS_XMLGEN.CTXHANDLE ;
XML CLOB ;
F UTL_FILE.FILE_TYPE;
XMLC VARCHAR2(32767);
BEGIN
CTX := DBMS_XMLGEN.NEWCONTEXT('SELECT * FROM department1 ') ;
XML := DBMS_XMLGEN.GETXML(CTX) ;
XMLC:=TO_CHAR(XML);
SHOW_ENVELOPE(XMLC);
F := UTL_FILE.FOPEN('ATTACH_FILES','DEPT.XML', 'W');
UTL_FILE.PUT_LINE(F,XML);
UTL_FILE.FCLOSE(F);
END ;
Good luck!!!
Bhagat
null -
Delete the data that is Loaded using BDC
Hi All,
We had loaded the data in SAP using BDC-Session Unfortunately.
Now we want to delete all the data which is loaded usong these sessions.
Please can anyone know the procedure to do so.(May be using LSMW)
It would be really great help.
Thank you,
Moderator message - Moved to the correct forum
Edited by: Rob Burbank on Sep 16, 2009 3:31 PMcan you tell me how you deleted the data using LSMW? I'm trying to use LSMW to delete contents of telephone and fax fields in Vendor Master, using batch recording. I've tried it two ways; loading "blank" phone/fax values from text file, and just setting a a rule of constant (of null) for the telephone/fax field in the mapping step and leaving it out of the upload file. The import and convert steps look fine and display the fields as blank but the field contents are not cleared after I run batch. I used these same objects to load phone number values to these fields with no problem so I know there are no errors in mapping, etc. Is there a trick to deleting fields using LSMW processing steps to clear fields in vendor master?
-
How to save the data to sap abap using Adobe Flex
Hi Everybody......
I am new to Adobe flex with sap abap.
How to save the data in sap abap using Adobe Flex coding is Action Script and using RFC web service.
Please give me any suggisions on that.
Thank you
Venkatesh VHi Venkatesh,
Try with folowing coding...
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
initialize="initApp()">
<mx:Label x="10" y="23" text="Airline" width="90" id="lblAirline"/>
<mx:TextInput x="108" y="21" id="txtAirline"/>
<mx:Button x="10" y="49" label="Get Data" id="btnGetData" enabled="false" click="getData()"/>
<mx:DataGrid x="10" y="97" id="dgFlightData" dataProvider="">
</mx:DataGrid>
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.rpc.AbstractOperation;
import mx.rpc.events.FaultEvent;
import mx.rpc.soap.LoadEvent;
import mx.rpc.events.ResultEvent;
import mx.rpc.soap.WebService;
[Bindable] public var flightData:ArrayCollection;
private var flightWS:WebService;
private function initApp():void{
flightWS = new WebService();
flightWS.wsdl = "http://uscib20.wdf.sap.corp:50021/sap/bc/soap/wsdl11?services=ZGTEST&sap-client=000";
flightWS.addEventListener(FaultEvent.FAULT,onWSError);
flightWS.addEventListener(LoadEvent.LOAD,onWSDLLoaded);
flightWS.addEventListener(ResultEvent.RESULT,onFlightWSGotResult);
flightWS.loadWSDL();
private function getData():void{
var operation:AbstractOperation = flightWS.getOperation("ZGTEST");
var input:Object = new Object();
input.Airline = txtAirline.text.toUpperCase();
operation.arguments = input;
operation.send();
private function onWSError (event:FaultEvent):void{
private function onWSDLLoaded(event:LoadEvent):void{
btnGetData.enabled = true;
private function onFlightWSGotResult(event:ResultEvent):void{
flightData = event.result.SFLIGHT;
]]>
</mx:Script>
</mx:Application>
Regards,
Vinoth -
How to delete the data from SAP R/3 DB table from BW
Hi,
I am facing an issue... I have populated the data into custom r/3 DB table by running a user exit.I am getting the data and loading(Full Load) it in BW ODS. But my problem is when i rerun the user exit it is giving me a short dump saying "SAPSQL_ARRAY_INSERT_DUPREC". when i delete the enteries of DB table it is working fine. But this fine in development.but i production i cannot do this.So i want to delete the DB table enteries by an ABAP program and call this ABAP program using Process chain when my ODS data LOAD is successful. How to go About this.
P.S: I want only to delete the DB table enteries not the DB table.....
Thanks and Regards
Sairam phaniSairam,
why don't you just add the code for deletion of records into that user exit, so it would first delete entries and then write new ones.
Alternatively, you could use a Process Chain to trigger an event in R/3, and by that event a scheduled job would run, deleting entries from that table.
As I don't know details of the solution you're implementing, that's all I can think of now.
Cheers,
/RB -
How to delete the data in P,Q and S table
Hi All,
I want to delete the data in /BIO/PCOSTCENTER, /BIO/QCOSTCENTER AND /BIO/SCOSTCENTER. Since we have transported the costcenter infoobject from 3.0B to BI 7. But the 3.0B doesnot contain the ALPHA conversion. So we need to delete the infoobject and install from BI content.
When I am trying to activate the BI 7 obj, It is giving the error message the above tables are containing the data.
Pls suggest how to delete them and activate the 0COSTCENTER with BI 7 version.
Points will be awarded.
Thanks
SathiyaProgram RSDMD_DEL_BACKGROUND is the appropriate choice to delete master data. You should be able to search OSS notes on te pgm to get a little more info on it.
It insures referential integrity by checking all InfoProviders to make sure a master data value for that InfoObject does not exist in any InfoProviders. This might not be an issue in your case if you are dealing with a newly activated object that you have don't have in any Infoproviders, but is the only the best way to delete master data. -
How to delete the data loaded into MySQL target table using Scripts
Hi Experts
I created a Job with a validation transformation. If the Validation was failed the data passed the validation will be loaded into Pass table and the data failed will be loaded into failed table.
My requirement was if the data was loaded into Failed database table then i have to delete the data loaded into the Passed table using Script.
But in the script i have written the code as
sql('database','delete from <tablename>');
but as it is an SQL Query execution it is rising exception for the query.
How can i delete the data loaded into MySQL Target table using scripts.
Please guide me for this error
Thanks in Advance
PrasannaKumarHi Dirk Venken
I got the Solution, the mistake i did was the query is not correct regarding MySQL.
sql('MySQL', 'truncate world.customer_salesfact_details')
error query
sql('MySQL', 'delete table world.customer_salesfact_details')
Thanks for your concern
PrasannaKumar
Maybe you are looking for
-
I think my hard drive crashed.... can it be replaced?
My macbook just crashed two nights ago. I tried to reboot, but did not work. My firefox was open, my iMovie was opened... then I switched it off and on back. There was this image (a box/folder with a question mark on it). Then I tried to reinstall my
-
Problem - cannot format hard drive even after replacement
Dead hard drive. I was able to recover part of the data in firewire mode. Rebooting from OSX disk hangs with a circle slash. Same if I try to reboot with Diskwarrior CD or TTPro. Removing the hard drive has the same result. Booting from an external f
-
Get Control inside ContentControl as CommandParameter and programatically
Hi, In a Window I've a ContentControl and a button <ContentControl x:Name="buscarRegion" prism:RegionManager.RegionManager="{Binding RegionManager, RelativeSource={RelativeSource AncestorType={x:Type Window}, Mode=FindAncestor}}" prism:RegionManager
-
My IPAD 2 is quite new. My connection to my home network has been working fine ... but has suddenly stopped working. When I go into Settings/WIFI I can turn the swith on but it doesn't seem to do anythin ... the WIFI setting still shows as OFF on the
-
I have bought several apps for my iPhone 4s and am quite content with it, but when prompted to upgrade to an iphone 5 I was wondering if there is a way to transfer all my paid apps to the new phone. I do not wish to loose any of my data!