Update not commit in a function
Hi,
I created a function that does an update. The SQL statement works fine on its own. But when I put this SQL statement in a function and used a .NET application to call this function, it didn't update the record. I even put the commit statement after the update but still no go. Any helps would be greatly appreciated.
Here is the Function:
create or replace
FUNCTION UPD_RENEWALDATE(CUST IN VARCHAR2, LOGON IN VARCHAR2, RNWL_DT IN DATE) RETURN INTEGER
IS
BEGIN
UPDATE "Customer" set
"RenewalDate" = TO_DATE(TO_CHAR(TRUNC(RNWL_DT) ,'MM/DD/YYYY'), 'MM/DD/YYYY'),
"ModifiedOn" = TRUNC(SYSDATE),
"ModifiedBy" = LOGON
WHERE "CustomerNumber" = CUST AND "IsCurrent" = 'Y';
COMMIT;
RETURN 1;
END;
Thanks for the suggestion. But I have codes in the .NET application that query the same table with the same input parms(CUST) and it returned the correct value. So if the CUST parm is not passing correctly, it should happened to all my read functions/SProc. I even hardcoded the value in parm1.value='123456' but it still won't update. CUST is varchar2 in the table but the content is numeric...weired.
Any help would be greatly appreciated. Here is the function to query the customer out before the update and it worked fine. The Update SProc is very similar to this but won't work.
Public Shared Function GetCustomer(ByVal CUST As String) As DataTable
Dim cnn As Oracle.DataAccess.Client.OracleConnection = New Oracle.DataAccess.Client.OracleConnection(ConfigurationSettings.AppSettings("ConnectionString"))
Dim cmd As Oracle.DataAccess.Client.OracleCommand = New Oracle.DataAccess.Client.OracleCommand("Get_Customer", cnn)
cmd.CommandType = CommandType.StoredProcedure
Dim p_refcursor As Oracle.DataAccess.Client.OracleParameter = New Oracle.DataAccess.Client.OracleParameter
p_refcursor.OracleDbType = OracleDbType.RefCursor
p_refcursor.Direction = ParameterDirection.ReturnValue
cmd.Parameters.Add(p_refcursor)
Dim Parm1 As Oracle.DataAccess.Client.OracleParameter = New Oracle.DataAccess.Client.OracleParameter
Parm1 = cmd.Parameters.Add(":CUST", OracleDbType.Varchar2, 7, CUST, ParameterDirection.Input)
Dim da As Oracle.DataAccess.Client.OracleDataAdapter = New Oracle.DataAccess.Client.OracleDataAdapter(cmd)
Dim ds As DataSet = New DataSet
Try
da.Fill(ds)
Return ds.Tables(0)
Catch
'Response.Write(vbCrLf & ex.ToString & vbCrLf)
Finally
da.Dispose()
p_refcursor.Dispose()
cmd.Dispose()
End Try
End Function
Similar Messages
-
After a recent iTunes update attempt iTunes no longer functions and the airport extreme base station is not accessable on our computer. We still have wifi but cannot access the base station software.
Thanks for the reply. I appreciate the response. I tried that approach this evening and it didn't work for me. (Technically it worked for me, when I was hardwired into my base station, but would not work for me wirelessly, which is my main issue.)
Again, using the approach you recommended works only if I have my ethernet cable attached to the LAN port so my computer is communicating directly to the base station through the hard wire. I am able to scan for my base station and make setting adjustments normally this way too.
As soon as I disconnect from the LAN port and try to go wireless is where I run into problems. The Base Station's wireless network I created is available to choose in the top right corner of the monitor with all of the other available wireless devices/networks -- but the network I created does not have access to the internet. I am also unable to configure my Base Station wirelessly. When my Airport Utility tries to scan for the Base Station and Network, it cannot find any Apple Wireless Device. It's like the Wireless Network in my base station is not sending out a signal.
Is there a way to resolve this issue? -
Qty update not active, function not possible error in MIGO
Dear all,
User faces , u201Cqty update not active, function not possibleu201D error in MIGO.
The receipt is for an STO and the material is split valuated. Qty and value updation is active and already similar receipt has been done for many qty.
Throw some light on this
Regards,
AntonyHi Antony,
Was the material type for the material changed recently? Pls. check the same.
If the qty update is active for the receiving plant & material type, then there should not be any issue.
Regards
Prabhu S -
How can apple send out an os update that renders an important function of the software/hardware to not work? They knowingly have sent out this new os update for iPad which makes airplay nonfunctining! I need this for my business! I could understand if they didn't know, but it is all over the Internet! When I went in to have it revert back to os6 (which worked fine!) I was actually asked if I had done any research before I installed the upgrade! As if this is the consumer's fault for being dumb enough to fall for the upgrade!
That is not what I have discovered, nor what others have discovered, nor what I was told when I went the Genius Bar. I cannot remotely mirror to my MacBook Pro and it only started the day after I installed the upgrade. We tested it with an iPad that had not been upgraded, no problem.
-
I deployed an EJB Stateless and Container_Managed into 8i 8.1.7.
The bean contains a method with a simple SQLJ insert statement and works fine, except for no commit is triggered by the Bean Container when method call is finished.
I can see that the insert was done, because the counter for my table is increased!
So the fault has to be that there is no commit!
Why does the Bean Container not commit, as it states in the EJB Online Documentation??Is it NT or solaris 8.1.7 ?
On solaris it should have worked. On NT it wouldn't work, unless you explicitly lookup
the datasource and do a ds.getConnection(), the container doesn't know what to commit. In general, hereafter, the bean code needs to explicitly lookup datasources and call getConnection() on the datasource so that the datasource is enlisted. Using the default kprb connection isn't going to work unless you explicitly set default-enlist tag to true in the XML deployment descriptor. -
Method CMD_EI_API MAINTAIN does not commit
Hi gurus,
I tried to use the method MAINTAIN in the class CMD_EI_API to create a new customer, I tried both from transaction se24 and from a report to call it. No error message and a new customer number generated but when a look for it in transaction XD03 I get the error message: Customer 10002 has not been created.
Any help will be appreciate
LeoHi ABAPers,
this is my example code for updating two KNVV-fields of a single customer.
As you might notice, one of the fields is a ZZ-field, which requires to do some additional
work to get it updated (Refer to my post at [CMD_EI_API usage together with KNVV append;).
Regards
Daniel Klein
DATA is_master_data TYPE cmds_ei_main.
DATA: es_master_data TYPE cmds_ei_main.
DATA: es_error TYPE cvis_message.
DATA: wa_customers TYPE cmds_ei_extern.
DATA: lt_sales TYPE cmds_ei_sales_t.
DATA: wa_sales LIKE LINE OF lt_sales.
* Check obligatory fields for KNVV
CHECK gp_vkorg IS NOT INITIAL AND gp_vtweg IS NOT INITIAL
AND gp_spart IS NOT INITIAL.
* Control parameters
wa_customers-header-object_instance-kunnr = '0006206900'. "customer number
wa_customers-header-object_task = 'U'. "update customer
APPEND wa_customers TO is_master_data-customers.
* Read customer
cmd_ei_api_extract=>get_data( EXPORTING is_master_data = is_master_data
IMPORTING es_master_data = es_master_data ).
* Change the read-data
CLEAR is_master_data.
is_master_data = es_master_data.
READ TABLE is_master_data-customers INDEX 1 INTO wa_customers.
DELETE is_master_data-customers INDEX 1.
lt_sales = wa_customers-sales_data-sales.
READ TABLE lt_sales WITH KEY data_key-vkorg = gp_vkorg
data_key-vtweg = gp_vtweg
data_key-spart = gp_spart
INTO wa_sales .
wa_sales-data-kvgr1 = 'BB'. "new field value
wa_sales-datax-kvgr1 = abap_true. "flag: change this field
wa_sales-data-zzbemerkung = 'MAINTAIN-Bemerkung'. "new field value
wa_sales-datax-zzbemerkung = abap_true. "flag: change this field
wa_sales-task = 'U'. "Maintaining-mode: update
CLEAR wa_customers-sales_data-sales.
APPEND wa_sales TO wa_customers-sales_data-sales.
APPEND wa_customers TO is_master_data-customers.
* Testing update on customer
cmd_ei_api=>maintain( EXPORTING is_master_data = is_master_data
IMPORTING es_error = es_error ).
IF es_error-is_error IS INITIAL.
* No errors? Commit work
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = abap_true.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
ENDIF.
Edited by: D. Klein [GER] on Nov 18, 2011 3:16 PM + Rollback -
Can not commit distributed transaction
Hi
We get error "can not commit distributed transaction" during
commit the transaction in which we have create NEW entities.
Update-transactions on existing enitites work correct.
Our problem is probably due to seauences for object IDs: we are using oracle native sequences:
<sequence name="SeqErrRecObj" strategy="nontransactional" factory-class="native(Sequence=BUYING.SEQ_ERRRECOBJ)"/>
As soon we use strategy="nontransactional" in managed environment,
we get "can not commit distributed transaction" error by creating new instance.
Switching to strategy="transactional" seems to eleminate this problem.
I did not found any hint in about this in documentation.
Can some one confirm our assumption that using nontransactional oracle sequences in manageg (WebLogic 9.2) environment
is responsible for "can not commit distributed transaction" error and "strategy=transactional" is the right solution.
Probably we are completely wrong and tehre is some other explanation for this error ?
kind regards
Andre TeshlerHi Andre,
It sounds like you have not configured a non-transactional datasource. See section "4.2.1. Managed and XA DataSources" in the <kodo>/docs/jdo/pdf/manual.pdf. Connection is for the managed datasource and Connection2 for the non-transactional.
David Ezzio -
Hi All, please find the code below
I'm calling this code throught form when button pressed trigger. i have not given any commit any where in form or script below. But it is getting updated in MTL_SYSTEM_ITEMS_B table. which actually should not happen? but i need to find why this getting updated.
please cany any one help me in this.
procedure upd_existing_items_att
(p_org_id in number, p_upload_seq_id in number, p_rcv_org_id in number, p_user_id in number, p_status out varchar2) is
l_sob number;
errexc exception;
begin
p_status := 'OK';
begin
select ood.set_of_books_id
into l_sob
from org_organization_definitions ood
where ood.operating_unit = p_org_id
and rownum = 1;
exception
when others then
p_status := 'Error: Failed to get SOB for '||p_org_id||chr(10)||substr(sqlerrm, 1, 150)||' [jnc_file_upload_pkg.upd_existing_items_att].';
rollback;
return;
end;
declare
cursor catt is
select nvl(j2.msi_att1,msi.attribute1) msi_att1, j2.inventory_item_id
from jnc_upload_file_trx_dtl j2, mtl_system_items_b msi
where j2.inventory_item_id is not null
and j2.inventory_item_id = msi.inventory_item_id
and j2.org_id = p_org_id
and j2.upload_seq_id = p_upload_seq_id
and msi.organization_id = (
select h.inv_master_org_id
from jnc_upload_format_colmap_hdr h, jnc_upload_file_trx_hdr s
where s.format_header_id = h.header_id
and s.upload_seq_id = p_upload_seq_id
and s.org_id = p_org_id
and rownum = 1)
and (j2.msi_att1 != nvl(msi.attribute1, '0'));
begin
for r1 in catt loop
update mtl_system_items_b b
set b.attribute1 = r1.MSI_ATT1, b.last_update_date = sysdate,
b.last_updated_by = p_user_id
where b.inventory_item_id = r1.inventory_item_id
and b.organization_id = (
select d.organization_id
from org_organization_definitions d
where d.organization_id = b.organization_id
and d.set_of_books_id = l_sob);
end loop;
end;
p_status := 'Maket price, attributes, segments, categories, cross ref has been updated if applicable';
exception
when others then
rollback;
p_status := 'Error: occured in updating attributes '||substr(sqlerrm, 1, 150)||' [jnc_file_upload_pkg.upd_existing_items_att].';
end upd_existing_items_att;i will explain you in clearly,
I have one form, which has one button in it. i will open the form and click on the button.
In WHEN-BUTTON-PRESSED trigger i'm calling one pl/sql program by passing parameters in it.
I will open the form, and directly click on the button which will directly call the pl/sql script, in the script also no commit is used. but it is updating data in the table.
till i commit the data should not commit in the tables.
this is my scenario. please help me in this
Thanks,
Siva. -
The detach from template function in Dreamweaver CC does not seem to be functional
Can some explain.
Bruce K.Hi Lalita
Yes you are correct, I TRY THE Modify -> Templates -> Detach from Template. I have built over 50 websites with this method using Modify -> Templates -> Detach from Template in DW CS5.5
After a save a page to a template for future ref.
I create a new page using this temp. but can not use the Modify -> Templates -> Detach from Template. The Detach from Template is not functional. It is there but when I mouse over its not operative.
Does DW CC need update maybe.
Thanks
Bruce -
Can not commit when using region in bounded task flow
Hi All
I am using Jdeveloper 11g R2 (11.1.2.3) & Weblogic 10.3.5.0
I have 2 bounded task flow in my application (A and B)
Each contain a fragment with few tabs (using af:panelTabbed)
I have another common functionality in this 2 bounded task flows
So I create another bounded task flow and add it as a region in tabs in task flows A and B
But when I am going to the common tab and insert record and commit using task flow commit it is not commit records in database
Is something wrong ? Any ideas how I can fix it?
Regards
MohsenHi Frank
I am using below code for commit (from TaskFlowUtils class)
public void commitTaskFlow() {
getDataControlFrame().commit();
public DataControlFrame getDataControlFrame() {
BindingContext bindingContext = oracle.adf.controller.binding.BindingUtils.getBindingContext();
String dataControlFrameName = bindingContext.getCurrentDataControlFrame();
DataControlFrame dataControlFrame = bindingContext.findDataControlFrame(dataControlFrameName);
return dataControlFrame;
Your comment was too helpful , I change data control scope to shared and it is working now
One more related question:
Is adding bounded task flow into another fragment as region an advised approach?
Thanks a lot
Regards
Mohsen -
I want single update query without use the function.
I want to update sells_table selling_code field with max date product_code from product table.
In product table there is multiple product_code date wise.
I have been done it with below quey with the use of function but can we do it in only one update query
without use the function.
UPDATE sells_table
SET selling_code = MAXDATEPRODUCT(ctd_vpk_product_code)
WHERE NVL(update_product_flag,0) = 0 ;
CREATE OR REPLACE FUNCTION HVL.maxdateproduct (p_product IN VARCHAR2) RETURN NUMBER
IS
max_date_product VARCHAR2 (100);
BEGIN
BEGIN
SELECT NVL (TRIM (product_code), 0)
INTO max_date_product
FROM (SELECT product_code, xref_end_dt
FROM product
WHERE TO_NUMBER (p_product) = pr.item_id
ORDER BY xref_end_dt DESC)
WHERE ROWNUM = 1; -- It will return only one row - max date product code
EXCEPTION
WHEN OTHERS
THEN
RETURN 0;
END;
RETURN max_date_product;
END maxdateproduct;
Thanks in Advance.Hi,
Something like this.
update setlls_table st
set selling_code =(select nvl(trim(product_code)) from
(select product_code
, rank() over (partition by item_id order by xref_end_dt DESC) rn
from product
) pr
where rn =1
and pr.item_id = st.ctd_vpk_product_code
) where NVL(update_product_flag,0) = 0 ;As such not tested due to lack of input sample.
Regards
Anurag Tibrewal. -
Update sap table using a function module call by php code
Hello,
I m trying to update the table VBAP using a function module ZZ_SET_DISTANCE call by a php code.
But I have this problem:
the saprfc seems to work well but when I look to the table VBAP the fields have not been update.
I tried the function module in debug mode and it work good. The fields are update.
I also handle the saprfc call function and the return SAPRFC_OK
This are the function module ZZ_SET_DISTANCE, and the php code
//PHP CODE
$fce = saprfc_function_discover($sap,"ZZ_SET_DISTANCE");
if (! $fce ) {echo "Echec d'ouverture du module fonction "; exit;}
saprfc_import ($fce,"COMMANDE", '0000001998');
saprfc_table_init($fce,"TBLE_CMDE");
$val=array();
$val['NUM_POST']='000030';
$val['HN_EXP']='';
$val['ST_EXP']='';
$val['PC_EXP']='';
$val['CI_EXP']='';
$val['CO_EXP']='';
$val['HN_REC']='';
$val['ST_REC']='';
$val['PC_REC']='';
$val['CI_REC']='';
$val['CO_REC']='';
$val['DIST']='popo';
saprfc_table_append ($fce,"TBLE_CMDE", $val);
$rfc_rc = saprfc_call_and_receive ($fce);
echo "\n".$rfc_rc;
if ($rfc_rc != SAPRFC_OK) { if ($sap == SAPRFC_EXCEPTION ) echo ("Exception raised: ".saprfc_exception($fce)); else echo (saprfc_error($fce)); }else{echo '/execution de la function ;}
saprfc_function_free($fce);
//FUNCTION MODULE ZZ_SET_DISTANCE
FUNCTION ZZ_SET_DISTANCE.
""Local Interface:
*" IMPORTING
*" VALUE(COMMANDE) TYPE VBELN
*" TABLES
*" TBLE_CMDE STRUCTURE ZADD_COM_LOXAN
DATA : NUMC TYPE VBELN.
NUMC = COMMANDE .
WHILE STRLEN( NUMC ) < 10 .
CONCATENATE '0' NUMC INTO NUMC .
ENDWHILE .
DATA tble_addrcomm LIKE LINE OF TBLE_CMDE .
LOOP AT TBLE_CMDE INTO tble_addrcomm.
DATA : NUMP TYPE POSNR.
NUMP = tble_addrcomm-NUM_POST.
WHILE STRLEN( NUMP ) < 6 .
CONCATENATE '0' NUMP INTO NUMP .
ENDWHILE .
UPDATE VBAP SET ARKTX = tble_addrcomm-DIST
WHERE VBELN EQ COMMANDE
AND POSNR EQ NUMP.
ENDLOOP.
ENDFUNCTION.
Is anybody can help me?
thank.Marie, create a Blog please, about more details for dummies....
1) how to connect to sap system?
2) you run the php code where? in a webserver or where?
3) wich is the url for run the FM: ZZ_SET_DISTANCE
4) you placed some dlls files on the web server?
please is interesting this...
Thanks -
OTA Update Not Querying Custom Update URL
I built Firefox 2.0 for the Nexus 4 and it does not check for updates using my custom update URL. The phone just sits on "Checking for updates..." My webserver logs also show there is no request for update.xml. Is this functionality missing? Can it be enabled by me?
2.0 isn't completely ready yet and obviously there are bugs... I'm not sure what's going on the issue you are having but the "Join the Firefox OS Community" at the bottom of this [https://developer.mozilla.org/en-US/Firefox_OS page] has some contact info so you can reach out to get some assistance with the issue you are having.
I'm not sure if stackoverflow helps but you can try posting there too! -
Since I migrated my files from one Mac to another and am now running Yosemite, Photoshop Elements 9 (adequate for what I do) is not showing the previous functionality on some of the tools. I have uninstalled/reinstalled twice to no avail. Is there a fix? Also, when I tried to update, it comes up with this error.
I have a similar problem. I found out that my macbook air created a new USER with my former's computer user name. You can check that by going into System Preferences -> User & Groups, and see if a "Other user" has been created. You have to login under this new USER to find your transferred contacts in the address book.
My problem is that I do not know how to merge the 2 USER logins or transfer the data from the new USER created into the existing one. -
Could not commit transaction Error 1 Detected During Transaction G/L Account
hi experts
when i was adding Sales Order i am getting an error as Could not commit transaction Error 1 Detected During Transaction G/L AccountHi,
Plz find the following threads:
Transaction failure with error message \"Error -1 detected during transaction\" when update the G\\L Account D…
"Could not commit transaction: Error -1 detected during transaction"
Could not commit transaction: Error -1 detected during transaction 'Payment Methods for Payment Wizard' (OPYM)
Could not commit transaction when inserting new items
Maybe you are looking for
-
SELECT OPTION in logical database PNP
Hi, when i use ligical database PNP and i'm entering a range in personnel number, in which variables is that stored? The select option in pnppernr, but this one is initial in start-of-selection and get event. Is there any othe structure containing th
-
How to deactivate an entry in tnsnames.ora file
Hi all, I am working with Oracle 10g enterprise edition. I have a data source named with DEVDATA which should not be affected while I am working on my project. Usually, I will add DEVDATA entry in tnsname.ora file if I want to use it and I will remov
-
iPhoto not seeing camera roll on iphone 4S. Have turned on Photo Stream because when iPhone is plugged into iMac, it no longer shows up as a device in iPhoto. How do I get the pics from phone to iPhoto. It will show any pictures taken after enabling
-
SQL Server Analysis services 2008 ODBC support
Hi, We are trying to use a data federation layer that provides ODBC access as a source for a SSAS cube. It looks like SSAS cannot access ODBC sources startign SSAS 2005 per documentation. Is there any solution to make this work. The data federation v
-
Change the language (locale) of the Portal
Hi everybody, I have to implement internationalization in my Portal. I do it throws bundle resources in my iview and throws Portal Content Translation for workset name. But now, I need to implement a iview in which there are 3 flag (english, french a