I have this problem:
I have this JavaScript code in a Dynamic Action:
var vMe = $(this.triggeringElement);
var vRow = $(vMe).parents(".meAllRow");
var vSeqID = $(vRow).find("[headers=SEQ_ID]").html();
var vEstado = $(vRow).find("[name=f01]").val();
apex.server.process("ajx_Cambia_estado",{x01:vSeqID,x02:vEstado});
and this is the PL-SQL CODE
DECLARE
vEstado VARCHAR2(1);
vSeq NUMBER := to_number(APEX_APPLICATION.g_x01);
BEGIN
IF (APEX_APPLICATION.g_x02 = 'A') THEN
vEstado := 'I';
ELSE
vEstado := 'A';
END IF;
APEX_COLLECTION.UPDATE_MEMBER (
p_collection_name => 'DINAMIC_LIST',
p_seq => vSeq,
p_c002 => vEstado);
END;
When I execute the dynamic action, it throws this error:
SyntaxError: Unexpected end of JSON
but when I put a return in the PL-SQL like:
htp.p('"process":"finish"');
the error disappears. But I don't need to send a response message, in Apex 4.2 I don't have this problem.
Try:
DECLARE
vEstado VARCHAR2(1);
vSeq NUMBER := to_number(APEX_APPLICATION.g_x01);
BEGIN
IF (APEX_APPLICATION.g_x02 = 'A') THEN
vEstado := 'I';
ELSE
vEstado := 'A';
END IF;
APEX_COLLECTION.UPDATE_MEMBER (
p_collection_name => 'DINAMIC_LIST',
p_seq => vSeq,
p_c002 => vEstado);
apex_json.open_object;
apex_json.write('success', true);
apex_json.close_object;
END;
Related
DECLARE
lv_json_values apex_json.t_values;
lv_items_count NUMBER := 0;
lv_id NUMBER := 0;
ip_json CLOB := '{ "items": [{ "tableName": "id_TRACKER", "count": 3, "columnNames": ["id"], "rows": [ ["9"], ["1"], ["2"]] }] }';
BEGIN
APEX_JSON.parse (p_source => ip_json, p_values => lv_json_values);
lv_items_count := apex_json.get_number(p_path => 'items[1].count',
p_values => lv_json_values);
dbms_output.put_line ('items Count : '||lv_items_count);
FOR lr_1 IN 1 .. lv_items_count
LOOP
lv_id := apex_json.get_number(p_path => 'items[1].rows[%d].',
p0 => 1, p1 => lr_1, p_values => lv_json_values);
dbms_output.put_line ('id : '||lv_id);
END LOOP;
end;
Since values id values 9,1 and 2 are wrapped as array inside array, all attempts to get all 3 values have failed,
I can get only the 1st id; when I do loop it this way; however - can never get 2nd and 3rd value.
Any help will be appreciated very much.
FOR lr_1 IN 1 .. lv_items_count
LOOP
lv_id := apex_json.get_number(p_path => 'items[1].rows[1][%d]',
p0 => lr_1, p_values => lv_json_values);
dbms_output.put_line ('id : '||lv_id);
END LOOP;
Here is your answer;
DECLARE
lv_json_values apex_json.t_values;
lv_items_count NUMBER := 0;
lv_id NUMBER := 0;
ip_json CLOB := '{ "items": [{ "tableName": "id_TRACKER", "count": 3, "columnNames": ["id"], "rows": [ ["9"], ["1"], ["2"]] }] }';
BEGIN
APEX_JSON.parse (p_source => ip_json, p_values => lv_json_values);
lv_items_count := apex_json.get_count(p_path => 'items[1].rows',p_values => lv_json_values);
dbms_output.put_line ('items Count : '||lv_items_count);
FOR i IN 1 .. lv_items_count
LOOP
lv_id := apex_json.get_number(p_path => 'items[1].rows[%d][1]',p0 => i, p_values => lv_json_values);
dbms_output.put_line ('id : '||lv_id);
END LOOP;
end;
I have tried several options, not sure what I am missing? thanks much. the filter_value in output always seems to be null. I am expecting to see something like this:
FILTER array count : 2
lov_for : Ids
v_count_2 : 3
filter_value : 1
filter_value : 2
filter_value : 3
lov_for : Amounts
v_count_2 : 4
filter_value : 20
filter_value : 30
filter_value : 50
filter_value : 60
DECLARE
v_a VARCHAR2(5000) :=
'{
"lovFilters": [
{
"lovFor": "Ids",
"values": [1,2,3]
},
{
"lovFor": "Amounts",
"values": [20,30,50,60]
}
]
}';
v_array_count NUMBER := 0;
lov_for VARCHAR2(30);
filter_value VARCHAR2(256);
v_count_2 NUMBER:= 0;
BEGIN
APEX_JSON.parse(v_a);
v_array_count := APEX_JSON.get_count(p_path => 'lovFilters');
dbms_output.put_line ('FILTER array count : '||v_array_count);
FOR lr_i IN 1 .. v_array_count
LOOP
dbms_output.put_line ('-------------------------');
lov_for := APEX_JSON.get_varchar2 (p_path => 'lovFilters[%d].lovFor', p0 => lr_i);
dbms_output.put_line ('lov_for : '||lov_for);
v_count_2 := APEX_JSON.get_count(p_path => 'lovFilters[%d].values', p0 => lr_i);
dbms_output.put_line ('v_count_2 : '||v_count_2);
dbms_output.put_line ('--------------------------');
FOR lr_n IN 1 .. v_count_2
LOOP
filter_value :=
APEX_JSON.get_varchar2(p_path => 'lovFilters[%d].values[%d]', p0 => lr_i, p1 => lr_n, p_values => l_json_values);
dbms_output.put_line ('filter_value : '||filter_value);
END LOOP;
END LOOP;
END;
Not sure what the problem was. Your code complained about l_json_values not being defined - maybe you copied some code from elsewhere ?
The following works:
DECLARE
l_json_text VARCHAR2(5000);
l_json_values apex_json.t_values;
l_array_count NUMBER := 0;
l_lov_for VARCHAR2(30);
l_filter_value VARCHAR2(256);
l_count_2 NUMBER:= 0;
BEGIN
l_json_text :=
'{
"lovFilters": [
{
"lovFor": "Ids",
"values": [1,2,3]
},
{
"lovFor": "Amounts",
"values": [20,30,50,60]
}
]
}';
apex_json.parse(
p_values => l_json_values,
p_source => l_json_text
);
l_array_count := APEX_JSON.get_count(p_path => 'lovFilters',p_values => l_json_values);
dbms_output.put_line ('FILTER array count : '||l_array_count);
FOR lr_i IN 1 .. l_array_count
LOOP
dbms_output.put_line ('-------------------------');
l_lov_for := APEX_JSON.get_varchar2 (p_path => 'lovFilters[%d].lovFor', p0 => lr_i, p_values => l_json_values);
dbms_output.put_line ('l_lov_for : '||l_lov_for);
l_count_2 := APEX_JSON.get_count(p_path => 'lovFilters[%d].values', p0 => lr_i, p_values => l_json_values);
dbms_output.put_line ('l_count_2 : '||l_count_2);
dbms_output.put_line ('--------------------------');
FOR lr_n IN 1 .. l_count_2
LOOP
l_filter_value :=
APEX_JSON.get_varchar2(p_path => 'lovFilters[%d].values[%d]', p0 => lr_i, p1 => lr_n, p_values => l_json_values);
dbms_output.put_line ('l_filter_value : '||l_filter_value);
END LOOP;
END LOOP;
END;
/
I am facing problem in uploading a file/ file attachments using RESTful API's. I am aware of APEX_WEB_SERVICES.MAKE_REST_REQUEST, but its giving me errors. If any1 has earlier used it, plz post an example or explain how it works.
My approach code:
declare
l_clob varchar2(32767);
l_in clob;
l_blob blob;
secure varchar2(100);
BEGIN
/*----------Setting Headers----------------------------------------*/
apex_web_service.g_request_headers(1).name := 'Accept';
apex_web_service.g_request_headers(1).Value := 'multipart/form-data';
apex_web_service.g_request_headers(1).name := 'Content-Type';
apex_web_service.g_request_headers(1).value := 'multipart/form-data';
/*-----------------------------------------------------------------*/
/*------------Calling Authentication Rest service------------------*/
l_clob := apex_web_service.make_rest_request(
p_url => 'My url to authenticate'
p_http_method => 'POST',
p_username => 'XXXXXX',
p_password => '######',
p_wallet_path => 'file:C:\Users\',
p_wallet_pwd => '5162);
/*------------- Retrieving Cookies---------------------------------*/
apex_collection.create_or_truncate_collection('P31_RESP_COOKIES');
for i in 1.. apex_web_service.g_response_cookies.count loop
IF (apex_web_service.g_response_cookies(i).secure) THEN
secure := 'Y';
ELSE
secure := 'N';
END IF;
apex_collection.add_member(p_collection_name => 'P31_RESP_COOKIES',
p_c001 => apex_web_service.g_response_cookies(i).name,
p_c002 => apex_web_service.g_response_cookies(i).value,
p_c003 => apex_web_service.g_response_cookies(i).domain,
p_c004 => apex_web_service.g_response_cookies(i).expire,
p_c005 => apex_web_service.g_response_cookies(i).path,
p_c006 => secure,
p_c007 => apex_web_service.g_response_cookies(i).version );
end loop;
/*------------------------------------------------------------------*/
/*------------- Setting Cookies-------------------------------------*/
for c1 in (select seq_id, c001, c002, c003, c004, c005, c006, c007
from apex_collections
where collection_name = 'P31_RESP_COOKIES' ) loop
apex_web_service.g_request_cookies(c1.seq_id).name := c1.c001;
apex_web_service.g_request_cookies(c1.seq_id).value := c1.c002;
apex_web_service.g_request_cookies(c1.seq_id).domain := c1.c003;
apex_web_service.g_request_cookies(c1.seq_id).expire := c1.c004;
apex_web_service.g_request_cookies(c1.seq_id).path := c1.c005;
if c1.c006 = 'Y' then
apex_web_service.g_request_cookies(c1.seq_id).secure := true;
else
apex_web_service.g_request_cookies(c1.seq_id).secure := false;
end if;
apex_web_service.g_request_cookies(c1.seq_id).version := c1.c007;
end loop;
select test_data into l_blob from my_table; -- gets blob datatype file
l_in := '<Entity Type="attachments">
<Fields>
<Field Name="filename">
<Value>sample case</Value>
</Field>
<Field Name="description">
<Value></Value>
</Field>
<Field Name="override-existing-attachment">
<Value>n<value/>
</Field>
<Field Name="ref-subtype">
<Value>0</Value>
</Field>
<Field Name="data">
<Value>';
l_in := l_in||apex_web_service.blob2clobbase64(l_blob);
dbms_output.put_line(l_in);
l_in := l_in||'</Value>
</Field>
</Fields>
</Entity>';
/*------------------------------------------------------------------*/
apex_web_service.g_request_headers(1).name := 'Accept';
apex_web_service.g_request_headers(1).Value := 'multipart/form-data';
apex_web_service.g_request_headers(1).name := 'Content-Type';
apex_web_service.g_request_headers(1).value := 'multipart/form-data';
/*-- not sure with the following code--*/
l_clob := apex_web_service.make_rest_request(p_url => 'myurl/tests/13142/attachments',
p_http_method => 'POST',
p_body = l_in,
p_body_blob => l_blob,
p_wallet_path => 'same as above',
p_wallet_pwd => 'same as above');
end;
Achieved it as:
/*change dis part in above code*/
select test_data into l_blob from h_attachments;
/*------------------------------------------------------------------*/
apex_web_service.g_request_headers(1).name := 'Accept';
apex_web_service.g_request_headers(1).Value := 'application/xml';
apex_web_service.g_request_headers(1).name := 'Content-Type';
apex_web_service.g_request_headers(1).value := 'application/octet-stream';
apex_web_service.g_request_headers(1).name := 'Slug';
apex_web_service.g_request_headers(1).value := 'filename.xls';
l_clob := apex_web_service.make_rest_request(p_url => 'your url path',
p_http_method => 'POST',
p_body_blob => l_blob,
p_wallet_path => 'file:C:\Users\ur path',
p_wallet_pwd => 'passwd');
I am getting this type of error:
=> i am getting error in the integration of the netsuite.
In sales order add the items in the netsuite so there are some error is define in above section my code is below please see the code add how to solve this problem.
[code] => USER_ERROR
[message] => You must enter at least one line item for this transaction.
[type] => ERRORi am gatting this type of error please help me
[code] => USER_ERROR
[message] => You must enter at least one line item for this transaction.
[type] => ERROR
my code is
include('NetSuiteService.php');
$service = new NetSuiteService();
if($order_items->netsuitid > 0){
$internal_Id = $order_items->netsuitid;
$emailCustomer = $order_items->user_email;
}
else{
$customer_Info = $order->get_customer_info($order->user_id);
$customer_information = array();
foreach($customer_Info as $customer_key => $customer_value){
if($customer_value->meta_key == 'first_name'){
$customer_information['first_name'] = $customer_value->meta_value;
}
if($customer_value->meta_key == 'last_name'){
$customer_information['last_name'] = $customer_value->meta_value;
}
}
$customer_information['email'] = $customer_Info->user_email;
//Add customer into net suit integration
$service = new NetSuiteService();
$customer = new Customer();
$customer->lastName = $customer_information['last_name'];
$customer->firstName = $customer_information['first_name'];
$customer->companyName = 'Company Name';
$customer->phone = '2222222222';
$customer->email = $customer_information['email'];
$emailCustomer = $customer_information['email'];
$request = new AddRequest();
$request->record = $customer;
$addResponse = $service->add($request);
if (!$addResponse->writeResponse->status->isSuccess) {
echo "You are already Registered with Netsuit.";
}
else {
$internal_Id = $addResponse->writeResponse->baseRef->internalId;
$order->insert_Customer($internal_Id,$order->user_id);
}
//End customer into net suit integration
}
//Add Product Information
/*$items = array();
foreach ( $order_items as $item_id => $item ) {
$itemRef = new nsRecordRef(array('internalId'=>$internal_Id));
$qty = $item['qty'];
if($item['type'] == 'line_item'){
$salesOrderItemFieldArray = array(
"item" => $itemRef,
"quantity" => $qty
);
}
if($item['type'] == 'fee'){
$salesOrderItemFieldArray = array(
"item" => $itemRef,
"quantity" => $qty
);
}
$SalesOrderItem->setFields($salesOrderItemFieldArray);
$items[] = $SalesOrderItem;
}
$salesOrderItemList = new nsComplexObject("SalesOrderItemList");
$salesOrderItemList->setFields(array(
"item" => $items
));
$salesOrderFields = array(
"orderStatus" => $order->status,
"entity" => '',
"getAuth" => true,
"shippingCost" => $order->order_shipping,
"shipMethod" => $order->payment_method,
"toBeEmailed" => true,
"email" => $emailCustomer,
"itemList" => $salesOrderItemList
);*/
$so = new SalesOrder();
//created Date
//$so->createdDate = $order->order_date;
//entity
$so->entity = new RecordRef();
$so->entity->internalId = $internal_Id;
$so->entity->name = $order->order_custom_fields['_billing_company'][0];
//Transaction Id
//$so->tranId = $order->order_custom_fields['Transaction ID'][0];
//Transaction Paid Date
//$so->tranDate = $order->order_custom_fields['_paid_date'][0];
//Source
$so->source = 'littlecrate';
//Created From
$so->createdFrom = 'littlecrate.com';
//Currency Name
require_once('geoplugin.class.php');
$geoplugin = new geoPlugin();
$geoplugin->currency = $order->order_custom_fields['_order_currency'];
$so->currencyName = $geoplugin->countryName;
$so->currency = $order->order_custom_fields['_order_currency'][0];
//Discount
$so->discountRate = $order->order_custom_fields['_order_discount'][0];
//Tax
$so->taxRate = $order->order_custom_fields['_order_tax'][0];
//email
$so->email = $order->billing_email;
//Status
//$so->orderStatus = $order->status;
//Billing Address
$so->billAddressList = array(
'billFirstname' => $order->order_custom_fields['_billing_first_name'][0],
'lastname' => $order->order_custom_fields['_billing_last_name'][0],
'billAddressee' => $order->order_custom_fields['_billing_address_1'][0],
'billAddr1' => $order->order_custom_fields['_billing_address_2'][0],
'billCountry' => $order->order_custom_fields['_billing_country'][0],
'billState' => $order->order_custom_fields['_billing_state'][0],
'billZip' => $order->order_custom_fields['_billing_postcode'][0],
'billPhone' => $order->order_custom_fields['_billing_phone'][0],
'billEmail' => $order->order_custom_fields['_billing_email'][0]);
//Shipping Address
$so->shipAddressList = array(
'shipFirstname' => $order->order_custom_fields['_shipping_first_name'][0],
'shipLastname' => $order->order_custom_fields['_shipping_last_name'][0],
'shipAddressee' => $order->order_custom_fields['_shipping_address_1'][0],
'shipAddr1' => $order->order_custom_fields['_shipping_address_2'][0],
'shipCity' => $order->order_custom_fields['_shipping_city'][0],
'shipState' => $order->order_custom_fields['_shipping_state'][0],
'shipZip' => $order->order_custom_fields['_shipping_postcode'][0],
'shiplPhone' => $order->order_custom_fields['_billing_phone'][0],
'shipEmail' => $order->order_custom_fields['_billing_email'][0]);
//Ship Date
//$so->shipDate = $order->order_custom_fields['Transaction ID'][0];
//Shipping Method
$so->shipMethod = $order->shipping_method;
//Shipping Charges
$so->shippingCost = $order->order_shipping;
//Shipping Tax Rate
$so->shippingTax1Rate = $order->order_shipping_tax;
//Payment Method
$so->paymentMethod = $order->payment_method;
//Sub Total
//$so->subTotal = $order->order_total;
//Discount Total(Cart Total)
//$so->discountTotal = $order->cart_discount;
//Tax Total
//$so->taxTotal = $order->order_tax;
//Total
//$so->total = $order->order_total;
//Product Listing
$arrItemsList = array();
$i = 0;
foreach($order_items_product as $keyProduct =>$valueProduct){
if($valueProduct['type'] == 'line_item'){
//$arrItemsList[$i]['item']['internalId'] = $valueProduct['product_id'];
//$arrItemsList[$i]['item']['externalId'] = $keyProduct;
$arrItemsList[$i]['item']['name'] = $valueProduct['name'];
$arrItemsList[$i]['item']['quantity'] = $valueProduct['qty'];
$arrItemsList[$i]['item']['description'] = $valueProduct['type'];
$arrItemsList[$i]['item']['amount'] = $valueProduct['line_total'];
}
if($valueProduct['type'] == 'fee'){
//$arrItemsList[$i]['item']['internalId'] = $valueProduct['product_id'];
//$arrItemsList[$i]['item']['externalId'] = $keyProduct;
$arrItemsList[$i]['item']['name'] = $valueProduct['name'];
$arrItemsList[$i]['item']['quantity'] = $valueProduct['qty'];
$arrItemsList[$i]['item']['description'] = $valueProduct['type'];
$arrItemsList[$i]['item']['amount'] = $valueProduct['line_total'];
}
$i++;
}
//print_r($arrItemsList);
$so->itemList->item = $arrItemsList;
/*$so->itemList = new SalesOrderItemList();
$soi = new SalesOrderItem();
$soi->item = new RecordRef();
$soi->item->internalId = 15;
$soi->quantity = 3;
$soi->price = new RecordRef();
$soi->price->internalId = $id;
$soi->amount = 55.3;
$so->itemList->item = array($soi);*/
$request = new AddRequest();
$request->record = $so;
//print_r($request);
$addResponse = $service->add($request);
print_r($addResponse);
exit;
if (!$addResponse->writeResponse->status->isSuccess) {
echo "ADD ERROR";
} else {
echo "ADD SUCCESS, id " . $addResponse->writeResponse->baseRef->internalId;
}
+
I Complited Using The Help Of Saqib,
http://stackoverflow.com/users/810555/saqib
He is The Great Developer And Regarding Netsuite Information Please Contact To Saqib Thanks Man U Just Do It.
<?php
$order_date = date('Y-m-d H:i:s');
// create array of fields
$itemArr = array();
$i = 0;
foreach($order_items_product as $keyProduct =>$valueProduct){
//if you not have internal id of item in netsuuite then please add the item in the netsuite and try.
$netsuiteItemId = 'Your Item Internal id Which is in the Netsuite Item';
$itemArr[$i]['item']['internalId'] = $netsuiteItemId;
$itemArr[$i]['quantity'] = $valueProduct['qty'];
$i++;
}
if (!define('LF', "\n")) {
define('LF', "\n");
}
/* for use in formatting custom addresses since NetSuite converts to <br> */
//Billing Address Information
/* this example has the customer address info in a db record, just pulled into $row */
$billAddress = stripslashes($order->order_custom_fields['_billing_first_name'][0]) . ' ' . $order->order_custom_fields['_billing_last_name'][0] . LF;
$billAddress .= stripslashes($order->order_custom_fields['_billing_address_1'][0]).LF;
$billAddress .= stripslashes($order->order_custom_fields['_billing_address_2'][0]).LF;
$billAddress .= stripslashes($order->order_custom_fields['_billing_country'][0]).LF;
$billAddress .= stripslashes($order->order_custom_fields['_billing_state'][0]) . ' - ' . $order->order_custom_fields['_billing_postcode'][0] . ', ' . LF;
$billAddress .= $order->order_custom_fields['_billing_phone'][0] . ', ' . $order->order_custom_fields['_billing_email'][0];
//Shipping Address Information
$shipAddress = stripslashes($order->order_custom_fields['_shipping_first_name'][0]) . ' ' . $order->order_custom_fields['_shipping_last_name'][0] . LF;
$shipAddress .= stripslashes($order->order_custom_fields['_shipping_address_1'][0]).LF;
$shipAddress .= stripslashes($order->order_custom_fields['_shipping_address_2'][0]).LF;
$shipAddress .= stripslashes($order->order_custom_fields['_shipping_city'][0]).LF;
$shipAddress .= stripslashes($order->order_custom_fields['_shipping_state'][0]) . ', ' . $order->order_custom_fields['_shipping_postcode'][0] . ', ' . LF;
$shipAddress .= $order->order_custom_fields['_billing_phone'][0] .', '. $order->order_custom_fields['_billing_email'][0];
$purchaseOrderFields = array (
'entity' => array ('internalId' => $internal_Id, 'type' => 'customer'),
'shippingCost' => $order->order_shipping,
'shipMethod' => $order->payment_method,
'toBeEmailed' => true,
//'tranId' => $order->order_custom_fields['Transaction ID'][0],
//'tranDate' => date('Y-m-d H:i:s'),
'source' => 'littlecrate',
'createdFrom' => 'littlecrate.com',
'discountRate' => $order->order_custom_fields['_order_discount'][0],
'taxRate' => $order->order_custom_fields['_order_tax'][0],
'email' => $order->billing_email,
//'shipDate' => date('Y-m-d H:i:s'),
'shipMethod' => $order->shipping_method,
'shippingCost' => $order->order_shipping,
'shippingTax1Rate' => $order->order_shipping_tax,
'paymentMethod' => $order->payment_method,
//'taxTotal' => $order->order_tax,
//'total' => $order->order_total,
'billAddress' => $billAddress,
'shipAddress' => $shipAddress,
'itemList' => array (
'item' => $itemArr
)
);
$salesOrder = new nsComplexObject('SalesOrder');
$salesOrder ->setFields($purchaseOrderFields);
$addResponse = $myNSclient->add($salesOrder );
if (!$addResponse->isSuccess) {
echo "Order Information is Not Inserted Into The Netsuite. Please Contact to Administration.";
exit;
}
?>
You item List object doesn't seem in correct format. Your code should look like this
$itemArr = array();
foreach($order_items_product as $keyProduct =>$valueProduct){
$item = new SalesOrderItem();
$item->item = $valueProduct['product_id'];
$item->quantity = $valueProduct['qty'];
$itemArr[] = $item;
}
$itemList = new SalesOrderItemList();
$itemList->item = $itemArr;
$so->itemList->item = $itemList;
I have page process that I am trying to run that will send an email if certain conditions are met. However, if the process does not pull any data, I still want the page to open like normal. I am stuck on 'ORA-01403: no data found' when the following Select statement runs:
select issue_added_to_alm into issue_added from Table_2 WHERE issue_Requester = '1234' and Issue_Added_To_ALM = '1' and EMAIL_NOTIFICATION = '0';
If I remove the initial select statement and replace the IF statement with the following:
IF :NEW.ISSUE_ADDED_TO_ALM = 1 THEN
I get: ORA-01008: not all variables bound
How do I achieve this?
declare
l_body varchar2(4000);
l_to_address varchar2(2000);
l_from varchar2(200) :='dq.issue.mgmt#jpmchase.com';
l_summary varchar2(1000);
l_description varchar2(4000);
l_ALM_ID varchar2(100);
l_subject varchar2(400);
l_added_to_alm varchar2(200);
issue_added varchar2(200);
begin
select
issue_added_to_alm
into issue_added
from Table_2
WHERE issue_Requester = '1234'
and Issue_Added_To_ALM = '1' and EMAIL_NOTIFICATION = '0';
if issue_added = 1 Then
select EMP_EMAIL_NAME
into l_to_address
from Table_1 where emp_id = '1234';
select
ISSUE_Summary,ISSUE_DESCRIPTION,ALM_ISSUE_ID,email_notification
into l_summary,l_description,l_ALM_ID,l_added_to_alm
FROM Table_2
WHERE issue_Requester = '1234' and Issue_Added_To_ALM = '1' and EMAIL_NOTIFICATION = '0';
l_subject := l_ALM_ID || 'Request has been created.';
l_body := '<style type="text/css">
p{font-family: Calibri, Arial, Helvetica, sans-serif;
font-size:12pt;
margin-left:30px;
}
</style>';
l_body := l_body || '<p>Your request has been created.</p>';
l_body := l_body || '<p>Data Quality Center received the following request:</p>';
l_body := l_body || '<p>Request ID: '|| l_ALM_ID ||'</p>';
l_body := l_body || '<p>Request Title: '|| l_summary||'</p>';
l_body := l_body || '<p>Request Description: '|| l_description||'</p>';
HTMLDB_MAIL.SEND(
P_TO => l_to_address,
P_FROM => l_from,
P_BODY => l_body,
P_BODY_HTML => l_body,
P_SUBJ => l_subject,
P_CC => l_from);
wwv_flow_mail.push_queue(
P_SMTP_HOSTNAME => 'mail.mailserver.net',
P_SMTP_PORTNO => '12'
);
UPDATE Table_2 set EMAIL_NOTIFICATION = 1 where ALM_ISSUE_ID = :l_ALM_ID;
end if;
end;
Many thanks in advance.
You just need to add an exception handler before the final end;:
...
exception
when no_data_found then
null;
end;