Varchar2 issue..
Hi all...
Database: oracle 11g
please help me with this issue.
we are calling a SQL server procedure which returs a string.
The string can be very large
The procedure is working fine on their side,
but if i call that procedure i am not getting any output.
*** anonymous completed with no errors, but not getting the output ***
DECLARE
v_return VARCHAR2(32000);
BEGIN
db.test_sql_proc@DB_SQL_LINK (1050 , v_return);
COMMIT;
dbms_output.put_line('output '||v_return);
END;Things that we tested..
1) no issues with the db link
2) no issues with the SQL server procedure
3) ***Strange thing that we found in the testing is ,
They are using VARCHAR(MAX) (SQL SERVER datatype) for the output parameter.
If in the SQL server procedure, if we change that to varchar(4000),
everything is working fine.
If SQL server procedure is using anything more than varchar(4000)
I am not getting the output
There is limit on Oracle side for varchar2 (4000) in SQL,
but over here it is PL/SQL, not sure why it is taking only 4000 charsPlease help me with this issue.
Try debugging your code and view the v_return using raise_application_error. Just want to make sure nothing wrong with the proc and it returns value
DECLARE
v_return VARCHAR2(32000);
BEGIN
db.test_sql_proc@DB_SQL_LINK (1050 , v_return);
COMMIT;
RAISE_APPLICATION_ERROR(-20001,'output '||v_return);
END;
{code}
Similar Messages
-
Date/varchar2 issues/confusion
I have a SP that takes in 2 dates as an input parameter and returns a ref_cursor containing data for that date range. In the table these dates are date data type. When I write the procedure, I am passing these dates as varchar2 and convert to date datatype in the where clause.
procedure get_hist(p_start_dt IN VARCHAR2,p_end_dt IN VARCHAR2, p_Out out refcurtype);On my query's where clause I give the condition </br>
and t2.START_TMSTMP >= TO_DATE(p_start_dt,'DD-MON-YYYY hh24:mi:ss')
and t2.END_TMSTMP <= to_date(p_end_dt,'DD-MON-YYYY hh24:mi:ss')However, I get no rows when I run the above proc like:</br>
var p_out refcursor;
exec get_hist('01-JUN-2008','01-JUN-2008',:p_out);
SQL> print p_out;
no rows selectedHowever, when I run the query for the procedure independently passing dates as 01-JAN-2008 etc it gives me rows.test@ORA10G>
test@ORA10G> desc t
Name Null? Type
NUM NUMBER
START_TMSTMP DATE
END_TMSTMP DATE
test@ORA10G>
test@ORA10G> select * from t;
NUM START_TMSTMP END_TMSTMP
1 01/01/2008 00:00:00 01/31/2008 00:00:00
2 02/01/2008 00:00:00 02/29/2008 00:00:00
3 03/01/2008 00:00:00 03/31/2008 00:00:00
4 04/01/2008 00:00:00 04/30/2008 00:00:00
5 05/01/2008 00:00:00 05/31/2008 00:00:00
6 06/01/2008 00:00:00 06/30/2008 00:00:00
6 rows selected.
test@ORA10G>
test@ORA10G> -- package
test@ORA10G> create or replace package my_pkg
2 as
3 type refcurtype is ref cursor;
4 procedure my_proc (p_start_dt in date,p_end_dt in date, p_out out refcurtype);
5 end my_pkg;
6 /
Package created.
test@ORA10G>
test@ORA10G> create or replace package body my_pkg
2 as
3 procedure my_proc (p_start_dt in date,p_end_dt in date, p_out out refcurtype) is
4 begin
5 open p_out for
6 select num,start_tmstmp,end_tmstmp
7 from t
8 where trunc(start_tmstmp) >= p_start_dt
9 and trunc(end_tmstmp) <= p_end_dt;
10 end;
11 end my_pkg;
12 /
Package body created.
test@ORA10G>
test@ORA10G> var p_start_dt VARCHAR2(20)
test@ORA10G> var p_end_dt varchar2(20)
test@ORA10G>
test@ORA10G> --
test@ORA10G> exec :p_start_dt := '01-JUN-2008';
PL/SQL procedure successfully completed.
test@ORA10G> exec :p_end_dt := '01-JUL-2008';
PL/SQL procedure successfully completed.
test@ORA10G>
test@ORA10G> var cr refcursor;
test@ORA10G> exec my_pkg.my_proc(to_date(:p_start_dt,'DD-MON-YYYY'), to_date(:p_end_dt,'DD-MON-YYYY'), :cr);
PL/SQL procedure successfully completed.
test@ORA10G>
test@ORA10G> print cr
NUM START_TMSTMP END_TMSTMP
6 06/01/2008 00:00:00 06/30/2008 00:00:00
1 row selected.
test@ORA10G>pratz -
Here is the setup that my server is running on:
Solaris 9.2
OCI Libraries 9.0.1
PHP 4.3.8
Databse on another server is 8i
I can connect and get some SQL queries to work, but any query that I have that references a varchar, nvarchar, varcha2, nvarchar2, char, nchar will not complete the process.
Example table
ThisTable
ID = Number
Title = varchar2
modeDate = date
SELECT ID FROM THISTABLE // <- this will work
SELECT modeDate FROM THISTABLE // <- This will work
SELECT TITLE FROM THISTABLE <- will not get anything from the resultset, as if it didn't run.
What I need to know is, should I downgrade my OCI libraries on my Solaris server? or what can I do, I have tried all converstions that I can think of, and I am able to get some information about the varchar field but no data out of the field. I can get the lenght, and I can get the first letter with ASCII. I have been hammering on this and am about to go to an XML solution if this can not be resolved. HELP!Below is an except of my code that I am using:
=========================================================
putenv("ORACLE_HOME=$home");
putenv("ORACLE_SID=TESTGEN");
putenv("TNS_ADMIN=$home/network/admin");
$connection = ocilogon ("myuser", "mypass", "sid");
if ($connection) {
$stmt = OCIParse($connection, "SELECT MEMO_BODY, ID FROM MEMO WHERE ID = 1066");
if ($stmt) {
if (OCIExecute($stmt)) {
OCIFetch($stmt);
print OCIResult($stmt, "MEMO_BODY");
} else {
$err = OCIError($stmt);
print $err["code"] . " 3";
} else {
$err = OCIError($connection);
print $err["code"] . " 2";
ocilogoff($connection);
} else {
$err = OCIError();
print $err["code"] . " 1";
=========================================================
And on the OCIResult for getting MEMO_BODY I get the 3106 error code displaied. -
Group by Perfromance issue with Number and Varchar2
Hi All,
I got a question on performance on GROUP BY clause.
Group by (Number) and Group by (Varchar2) --> In these 2 versions of Group by will oracle takes into consideration for the data types in the GROUP BY Clause as a performance issue.
I.E. Select sum(sal) from emp group by deptno and Select sum(sal) from emp group by job.
In the first group by we have number and second we got varchar2. So oracle will take the data types also into consideration for performance in the Group by clause.
(Pls dont consider the amount of data in the tables ).
Appreciate your response,
Thanks,
Madhu K.You are asking which way is more efficient?
if someone ask to do a group by using a varchar column. oracle has no other way to do it but by the columns that the developer asks for...
Amiel -
Issue with Varchar2 field conversion for report output generated in EXCEL
Hello All,
I have an unique problem with one of my new reports for the User. The user wants the report output generated in excel data only(delimited data) format *(reports builder 10g)* .
Everything was fine until i encountered this problem, there was this field which has unique ID's(alphanumeric and numeric), when i tried to run the report and generate output in Excel the numeric ID's say for example *(41593497999679354429)* is converted in excel and displayed like *(2.5881E+19)* and after format cells in excel it displays *(41593497999679300000).*
The issue is only with 20 digits numeric ID's , if i append any special character to the end say '#' or '..' it shows the exact value along with the appended character. But the user insist they need only the value that is in the table. I am finding it hard to figure out, if any one of you have encountered the same issue or if any of you have any suggestions to overcome this excel conversion thing please do advice me.
Thanks in advance :)Thanks for you response, but i already tried what you suggested, instead of appending single quote in front of ID, i did at the end prior with '#', it preserves the value if i add any character to the id but the appended value shows up too :(.
Well, i just got the solution and it did work, thanks to [Brian Hill|https://forums.oracle.com/forums/thread.jspa?threadID=651632] for the post, i did what exactly he said and it worked. I was so very happy and wanted to share with everyone. -
Performance issue.... ( varchar2 - clob ).
Hi all,
I have a table ( data ) with the following configuration :
id number(10),
value charchar2(500)
I need to convert the value field from type varchar2 to clob.
for that I done the following:
SQL>create table temp as select * from data;
Table created.
SQL>truncate table data;
SQL>alter table data drop ( value );
SQL>alter table data add ( value clob );
SQL>alter table data move LOB(value) store as ( tablespace LOB disable storage in row nochace nologging );
SQL>alter table data nologging;
SQL>insert into data select * from temp;
The first step took 1 min. ( i have 2700000 records );
but the last step take ages...
Can anyone get a clue of why it is soooo slow ? ( maybe the "on the fly" conversion from varchar2 to clob ? )
Thanks,
Roye Avidorthe /*+ APPEND */ hint doesn't make it faster.
nice try :) -
Export to Excel, VARCHAR2 DB Type and leading zeros issue
Oracle JHeadstart Release 11.1.1.2.29
We are using the Export to excel option, but when we have leading zeros it doesn't export it as text so the data is incorrect.
Can any one please tell how doe we configure ADF to have the leading zeros and export it as text rather than as number.
<af:commandMenuItem partialSubmit="true"
textAndAccessKey="#{nls['EXPORT']}"
icon="/jheadstart/images/excel.png"
immediate="true" id="cmi0">
<af:exportCollectionActionListener exportedId="IdLookupTab"
type="excelHTML"/>
</af:commandMenuItem>
Regards
Ramyou could add an apostrophe ' in front of all fields that you want exported as a text.
this will ensure no truncating is done.
it's excel that does the shifting, so you can't really interfere from the SAP side -
Issue with JPDs in my weblogic application
I have a weblogic integration application running on WL 8.1 SP5. There are 2 JPDs and 2 web services in the application. I am having an issue in the live server when the application has been running for quite a while. One of the JPDs stops working. The issue is resolved by redeploying the application. On redeploying from the weblogic console, the code starts to run again!!! Has any one come across such an issue? Is this something to do with server settings? I would welcome any suggestions to solve this recurring issue.
Hi Darshan,
Thanks for your answer.
I change my package to do an another test.
My XML :
<dataTemplate name="XXAPINMOXML" description="SUIVI DES INTERETS MORATOIRES" defaultPackage="XXAPINMO_PKG">
<dataQuery>
<parameters>
<parameter name="p_type_edition"/>
</parameters>
<PROPERTIES>
<property name="include_parameters" value="true"/>
</PROPERTIES>
My package :
CREATE OR REPLACE PACKAGE XXAPINMO_PKG AS
p_type_edition varchar2(150);
FUNCTION beforeReport return boolean;
END XXAPINMO_PKG;
show errors package XXAPINMO_PKG;
CREATE OR REPLACE PACKAGE BODY XXAPINMO_PKG
AS
FUNCTION beforeReport return boolean is
BEGIN
fnd_file.put_line(FND_FILE.LOG,'p_type_edition ' || p_type_edition);
IF p_type_edition = 'Y' THEN
fnd_file.put_line(FND_FILE.LOG,'Case Y');
ELSE
fnd_file.put_line(FND_FILE.LOG,'Case N');
END IF;
return true;
END beforeReport;
END XXAPINMO_PKG;
show errors package body XXAPINMO_PKG;
Then I launch my concurrent program with 'Y' in parameter and I see the log of my concurrent program :
XDO Data Engine Version No: 5.6.3
Resp: 51213
Org ID : 45
Request ID: 2468909
All Parameters: p_type_edition=Y
Data Template Code: XXAPINMOXML
Data Template Application Short Name: XXAP
Debug Flag: N
{p_type_edition=Y}
Calling XDO Data Engine...
Début des messages de journalisation à partir du fichier FND_FILE.
p_type_edition
Case N
Fin des messages de journalisation à partir du fichier FND_FILE.
But normally it should be 'Case Y' which would be written ...
And when I see the XML via Diagnostic I don't see the parameter however I add <property ...>
I really don't understand ...
Maybe do you have an another idea ?
Frédérique -
Hi Gurus,
I am dier need of one of the xml issue which I am facing right now.
I am reading one of the xml file which is like this
<?xml version="1.0" encoding="UTF-8" ?>
- <GEBIZ_ORDER xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <HEADER>
<MINISTRY_CODE>RPO</MINISTRY_CODE>
<DEPARTMENT_CODE>000</DEPARTMENT_CODE>
<ORDER_CODE>RPO000EPO11000953</ORDER_CODE>
<EXTERNAL_SYSTEM_CODE>E</EXTERNAL_SYSTEM_CODE>
<AMENDMENT_NUMBER>0</AMENDMENT_NUMBER>
<VARIATION_NUMBER>0</VARIATION_NUMBER>
<DESCRIPTION>Purchase Order for Air tickets for SOT to Korea (from 17th - 26th Sep 2011) off PC(RPO000ECN11000100)for SAS</DESCRIPTION>
<STATUS>NEW</STATUS>
<STATUS_DATE>2011-07-08T16:57:39</STATUS_DATE>
<PAYMENT_TERMS xsi:nil="true" />
<BILL_TO>One-Stop Centre, 9 Woodlands Avenue 9, S(738964)</BILL_TO>
<JUSTIFICATION>Please refer to attached approval email.</JUSTIFICATION>
<CREATE_TIMESTAMP>2011-07-08T16:57:39</CREATE_TIMESTAMP>
<TERMINATE_REASON xsi:nil="true" />
<TERMINATE_TIMESTAMP xsi:nil="true" />
<ORDER_TYPE>1</ORDER_TYPE>
- <FINANCIAL_SYSTEM>
<SUB_BUSINESS_UNIT>RPS01</SUB_BUSINESS_UNIT>
</FINANCIAL_SYSTEM>
- <SUPPLIER>
<CODE>200003048E</CODE>
<NAME>Safe2Travel Pte Ltd</NAME>
<GST_NUMBER>20-0003048-E</GST_NUMBER>
<CONTACT_NAME>ONG PEI LENG</CONTACT_NAME>
<CONTACT_PHONE>68233103</CONTACT_PHONE>
<CONTACT_EMAIL>[email protected]</CONTACT_EMAIL>
<CONTACT_FAX>68221636</CONTACT_FAX>
- <SITES>
- <SITE>
<ID>1</ID>
<NAME>ravel Pte Ltd</NAME>
<PHONE>68233013</PHONE>
<PHONE_EXTENSION xsi:nil="true" />
<FAX>68221636</FAX>
<EMAIL>[email protected]</EMAIL>
<ADDRESS_LINE1>10 Eunos Road 8</ADDRESS_LINE1>
<ADDRESS_LINE2>#08-03 (North Lobby)</ADDRESS_LINE2>
<ADDRESS_LINE3>Singapore Post Centre</ADDRESS_LINE3>
<COUNTRY_CODE>SG</COUNTRY_CODE>
<PROVINCE xsi:nil="true" />
<STATE xsi:nil="true" />
<CITY xsi:nil="true" />
<AREA_CODE xsi:nil="true" />
<ZIP>408600</ZIP>
<REGION_CODE xsi:nil="true" />
</SITE>
- <SITE>
<ID>2</ID>
<NAME>ravel Pte Ltd</NAME>
<PHONE>62208866</PHONE>
<PHONE_EXTENSION xsi:nil="true" />
<FAX>62265578</FAX>
<EMAIL>[email protected]</EMAIL>
<ADDRESS_LINE1>3 Lim Teck Kim Road</ADDRESS_LINE1>
<ADDRESS_LINE2>#02-02</ADDRESS_LINE2>
<ADDRESS_LINE3>Singapore Technologies Building</ADDRESS_LINE3>
<COUNTRY_CODE>SG</COUNTRY_CODE>
<PROVINCE xsi:nil="true" />
<STATE xsi:nil="true" />
<CITY xsi:nil="true" />
<AREA_CODE xsi:nil="true" />
<ZIP>088934</ZIP>
<REGION_CODE xsi:nil="true" />
</SITE>
- <SITE>
<ID>3</ID>
<NAME>Safe2Travel Pte Ltd</NAME>
<PHONE>62208866</PHONE>
<PHONE_EXTENSION xsi:nil="true" />
<FAX>62265578</FAX>
<EMAIL>[email protected]</EMAIL>
<ADDRESS_LINE1>3 Lim Teck Kim Road</ADDRESS_LINE1>
<ADDRESS_LINE2>#02-02</ADDRESS_LINE2>
<ADDRESS_LINE3>Singapore Technologies Building</ADDRESS_LINE3>
<COUNTRY_CODE>SG</COUNTRY_CODE>
<PROVINCE xsi:nil="true" />
<STATE xsi:nil="true" />
<CITY xsi:nil="true" />
<AREA_CODE xsi:nil="true" />
<ZIP>088934</ZIP>
<REGION_CODE xsi:nil="true" />
</SITE>
</SITES>
</SUPPLIER>
- <USER>
<CODE>JOYCE SOON</CODE>
<NAME>JOYCE SOON</NAME>
<ORGANISATION_NAME>Republic Polytechnic</ORGANISATION_NAME>
</USER>
- <FUND_COMMIT_AMOUNT>
<CURRENCY_CODE>SGD</CURRENCY_CODE>
<CURRENCY_RATE>1</CURRENCY_RATE>
<CURRENCY_RATE_DATE>1900-01-01T00:00:00</CURRENCY_RATE_DATE>
<CURRENCY_RATE_TYPE>BOOK</CURRENCY_RATE_TYPE>
<CURRENCY_AMOUNT>21551.4</CURRENCY_AMOUNT>
</FUND_COMMIT_AMOUNT>
- <PERIOD_CONTRACT>
<CODE>RPO000ECN11000100</CODE>
<AGENCY_CODE>RPO000</AGENCY_CODE>
<ADMIN_FEE_SGD_AMOUNT>0</ADMIN_FEE_SGD_AMOUNT>
</PERIOD_CONTRACT>
- <BUYER>
<ORGANISATION_CODE>1</ORGANISATION_CODE>
<ORGANISATION_NAME>Republic Polytechnic</ORGANISATION_NAME>
<NAME>Sally Ang</NAME>
<PHONE>31001711</PHONE>
<FAX>64151310</FAX>
<EMAIL>[email protected]</EMAIL>
</BUYER>
<APPROVING_OFFICERS />
</HEADER>
- <ITEMS>
- <ITEM>
<LINE_NUMBER>1</LINE_NUMBER>
<STATUS>NEW</STATUS>
<STATUS_DATE>2011-07-08T16:57:39</STATUS_DATE>
<DESCRIPTION>Return Air Ticket including Airport Taxes and Fuel Surcharges (2 staff and 24 students)</DESCRIPTION>
<UNIT_OF_MEASURE>PAX</UNIT_OF_MEASURE>
<QUANTITY>26</QUANTITY>
<LINE_TYPE>SERVICES</LINE_TYPE>
<UNIT_PRICE>828.9</UNIT_PRICE>
<PRICE_UNIT>1</PRICE_UNIT>
<TOTAL_AMOUNT>21551.4</TOTAL_AMOUNT>
<MATERIAL_MASTER_CODE xsi:nil="true" />
<MATERIAL_GROUP_CODE xsi:nil="true" />
<PLANT_CODE xsi:nil="true" />
<ITEM_CATEGORY_CODE xsi:nil="true" />
<ADMIN_FEE_SGD_AMOUNT>0</ADMIN_FEE_SGD_AMOUNT>
<INSTRUCTION_TO_SUPPLIER>Purchase of goods/services is subject to the Terms & Conditions found in www.rp.sg/purchase and/or in the ITQ/ITT Specifications. Please liaise with the Contact Person for delivery details. Invoice MUST be addressed to the Contact Person. PO number MUST be included in the Description field under e-Invoice Details section at Vendor@Gov.</INSTRUCTION_TO_SUPPLIER>
<PERIOD_CONTRACT_LINE_NUMBER>1</PERIOD_CONTRACT_LINE_NUMBER>
<GOODS_INSPECT_FLAG>N</GOODS_INSPECT_FLAG>
- <PURCHASE_REQUEST>
<CODE>RPO000EPR11000465</CODE>
<LINE_NUMBER>1</LINE_NUMBER>
</PURCHASE_REQUEST>
- <PART_NUMBER_INFORMATION>
<NATO_STOCK_NUMBER xsi:nil="true" />
<MANUFACTURER_PART_NUMBER xsi:nil="true" />
<PART_NUMBER xsi:nil="true" />
<CAGE_CODE xsi:nil="true" />
<CAGE_NAME xsi:nil="true" />
<ITEM_CONDITION xsi:nil="true" />
<MINIMUM_SHELF_LIFE xsi:nil="true" />
<SHELF_LIFE_REMAINING xsi:nil="true" />
<CERTIFICATE_OF_CONFORMANCE xsi:nil="true" />
<EXPORT_LICENSE xsi:nil="true" />
</PART_NUMBER_INFORMATION>
- <LOCATIONS>
- <LOCATION>
<LINE_NUMBER>1</LINE_NUMBER>
<STATUS>NEW</STATUS>
<STATUS_DATE>2011-07-08T16:57:39</STATUS_DATE>
<QUANTITY>26</QUANTITY>
<DELIVERY_DESTINATION>Republic Polytechnic, One-Stop Centre, 9 Woodlands Avenue 9, S(738964)</DELIVERY_DESTINATION>
<DELIVERY_DATE>2011-07-11T00:00:00</DELIVERY_DATE>
<DELIVERY_TERMS>LOC</DELIVERY_TERMS>
<PORT_OF_ORIGIN>-</PORT_OF_ORIGIN>
- <RECIPIENT>
<CODE>OSC</CODE>
<NAME>One Stop Centre</NAME>
<PHONE>65103000</PHONE>
<EMAIL>[email protected]</EMAIL>
</RECIPIENT>
- <DISTRIBUTIONS>
- <DISTRIBUTION>
<LINE_NUMBER>1</LINE_NUMBER>
<STATUS>NEW</STATUS>
<STATUS_DATE>2011-07-08T16:57:39</STATUS_DATE>
<QUANTITY>26</QUANTITY>
<CHART_OF_ACCOUNT>1/G01/3SAS/020/220908/0000/0000/0000</CHART_OF_ACCOUNT>
<PROJECT_DISTRIBUTION xsi:nil="true" />
</DISTRIBUTION>
</DISTRIBUTIONS>
</LOCATION>
</LOCATIONS>
</ITEM>
</ITEMS>
</GEBIZ_ORDER>I was able to read this kind of file structure but due to some constraints now they added supplier sites and increment that one which will be like variable kind of thing now.
And below mentioned is the script which I am using right now for reading that xml file
PROCEDURE XGBZPROD.XGBZ_PUR_ORD_XMLTAG_PROC(P_XML_FILE IN VARCHAR2, P_FOLDER_NAME IN VARCHAR2)
IS
lv_supp_file XMLTYPE;
lv_hdr_error VARCHAR2(240);
lv_line_error VARCHAR2(240);
lv_line_loc_err VARCHAR2(240);
lv_dist_err VARCHAR2(240);
l_file_name VARCHAR2(300);
l_folder_name VARCHAR2(300);
lv_sysdate DATE := sysdate;
BEGIN
l_file_name := p_xml_file;
l_folder_name := p_folder_name;
-- this clause to check whether is xml file or NODATA FILE.
IF upper(substr(l_file_name,instr(l_file_name,'.',1)+1,3)) ='XML' THEN
lv_supp_file := xmltype( bfilename('XMLDIR',P_XML_FILE), nls_charset_id('AL32UTF8'));
dbms_output.put_line('P_XML_FILE '||P_XML_FILE);
-- Initially insert data into 11g table
-- This is to read xml datafile
INSERT INTO XGBZ_PO_XML_DETAILS
(ministry_code ,
department_code ,
order_code ,
external_system_code ,
amendment_number ,
variation_number ,
description ,
status ,
status_date ,
payment_terms ,
bill_to ,
justification ,
create_timestamp ,
terminate_reason ,
terminate_timestamp ,
order_type ,
sub_business_unit ,
cost_center_group ,
buyer_code ,
financial_system_order_code ,
user_nric ,
supplier_code ,
supplier_name ,
gst_number ,
contact_name ,
contact_phone ,
contact_email ,
contact_fax ,
supp_site_id ,
supp_site_name ,
supp_site_phone ,
supp_sit_phone_ext ,
supp_site_fax ,
supp_site_email ,
supp_site_add_line1 ,
supp_site_add_line2 ,
supp_site_add_line3 ,
supp_site_country_code ,
supp_site_province ,
supp_site_state ,
supp_site_city ,
supp_site_area_code ,
supp_site_zip ,
supp_site_region_code ,
user_code ,
user_name ,
user_org_name ,
currency_code ,
currency_rate ,
currency_rate_date ,
currency_rate_type ,
currency_amount ,
tx_field_2 ,
agency_code ,
admin_fee_sgd ,
buyer_orgn_code ,
buyer_orgn_name ,
buyer_name ,
buyer_phone ,
buyer_fax ,
buyer_email ,
ao_code ,
ao_name ,
line_no ,
line_status ,
line_status_date ,
line_description ,
unit_of_measure ,
line_qty ,
line_type ,
unit_price ,
line_total_amount ,
material_master_code ,
material_group_code ,
item_category_code ,
line_admin_fee_sgd_amt ,
instruction_supplier ,
period_contract_line_no ,
goods_inspect_flag ,
pr_code ,
pr_line_number ,
nato_stock_number ,
manufacturer_part_no ,
part_number ,
cage_code ,
cage_name ,
item_condition ,
minimum_shelf_life ,
shelf_life_remaining ,
cert_of_conformance ,
export_license ,
line_location_no ,
line_loc_status ,
line_loc_status_date ,
line_loc_qty ,
delivery_destination ,
delivery_date ,
delivery_terms ,
port_of_origin ,
recipient_code ,
recipient_name ,
recipient_phone ,
recipient_email ,
dist_line_no ,
dist_line_status ,
dist_line_status_date ,
dist_line_qty ,
chart_of_account ,
project_distribution
SELECT --Header Data
ministry_code ,
department_code ,
order_code ,
external_system_code ,
amendment_number ,
variation_number ,
description ,
status ,
status_date ,
payment_terms ,
bill_to ,
justification ,
create_timestamp ,
terminate_reason ,
terminate_timestamp ,
order_type ,
sub_business_unit ,
cost_center_group ,
buyer_code ,
financial_system_order_code ,
user_nric ,
supplier_code ,
supplier_name ,
gst_number ,
contact_name ,
contact_phone ,
contact_email ,
contact_fax ,
supp_site_id ,
supp_site_name ,
supp_site_phone ,
supp_sit_phone_ext ,
supp_site_fax ,
supp_site_email ,
supp_site_add_line1 ,
supp_site_add_line2 ,
supp_site_add_line3 ,
supp_site_country_code ,
supp_site_province ,
supp_site_state ,
supp_site_city ,
supp_site_area_code ,
supp_site_zip ,
supp_site_region_code ,
user_code ,
user_name ,
user_org_name ,
currency_code ,
currency_rate ,
currency_rate_date ,
currency_rate_type ,
currency_amount ,
tx_field_2 ,
agency_code ,
admin_fee_sgd ,
buyer_orgn_code ,
buyer_orgn_name ,
buyer_name ,
buyer_phone ,
buyer_fax ,
buyer_email ,
ao_code ,
ao_name ,
line_no ,
line_status ,
line_status_date ,
line_description ,
unit_of_measure ,
line_qty ,
line_type ,
unit_price ,
line_total_amount ,
material_master_code ,
material_group_code ,
item_category_code ,
line_admin_fee_sgd_amt ,
instruction_supplier ,
period_contract_line_no ,
goods_inspect_flag ,
pr_code ,
pr_line_number ,
nato_stock_number ,
manufacturer_part_no ,
part_number ,
cage_code ,
cage_name ,
item_condition ,
minimum_shelf_life ,
shelf_life_remaining ,
cert_of_conformance ,
export_license ,
line_location_no ,
line_loc_status ,
line_loc_status_date ,
line_loc_qty ,
delivery_destination ,
delivery_date ,
delivery_terms ,
port_of_origin ,
recipient_code ,
recipient_name ,
recipient_phone ,
recipient_email ,
dist_line_no ,
dist_line_status ,
dist_line_status_date ,
dist_line_qty ,
chart_of_account ,
project_distribution
FROM XMLTable('/GEBIZ_ORDER'
passing lv_supp_file
columns
ministry_code VARCHAR2(3) path 'HEADER/MINISTRY_CODE',
department_code VARCHAR2(3) path 'HEADER/DEPARTMENT_CODE',
order_code VARCHAR2(17 ) path 'HEADER/ORDER_CODE',
external_system_code VARCHAR2(1) path 'HEADER/EXTERNAL_SYSTEM_CODE',
amendment_number VARCHAR2(5) path 'HEADER/AMENDMENT_NUMBER' ,
variation_number VARCHAR2(5) path 'HEADER/VARIATION_NUMBER',
description VARCHAR2(500) path 'HEADER/DESCRIPTION',
status VARCHAR2(500) path 'HEADER/STATUS',
status_date VARCHAR2(24) path 'HEADER/STATUS_DATE',
payment_terms VARCHAR2(400) path 'HEADER/PAYMENT_TERMS',
bill_to VARCHAR2(200) path 'HEADER/BILL_TO',
justification VARCHAR2(400) path 'HEADER/JUSTIFICATION',
create_timestamp VARCHAR2(24) path 'HEADER/CREATE_TIMESTAMP',
terminate_reason VARCHAR2(400) path 'HEADER/TERMINATE_REASON',
terminate_timestamp VARCHAR2(24) path 'HEADER/TERMINATE_TIMESTAMP',
order_type VARCHAR2(2 ) path 'HEADER/ORDER_TYPE',
sub_business_unit VARCHAR2(5 ) path 'HEADER/FINANCIAL_SYSTEM/SUB_BUSINESS_UNIT',
cost_center_group VARCHAR2(20 ) path 'HEADER/FINANCIAL_SYSTEM/NFS/COST_CENTER_GROUP',
buyer_code VARCHAR2(30 ) path 'HEADER/FINANCIAL_SYSTEM/NFS/BUYER_CODE',
financial_system_order_code VARCHAR2(20 ) path 'HEADER/FINANCIAL_SYSTEM/NFS/FINANCIAL_SYSTEM_ORDER_CODE',
user_nric VARCHAR2(9 ) path 'HEADER/FINANCIAL_SYSTEM/NFS/USER_NRIC',
supplier_code VARCHAR2(10) path 'HEADER/SUPPLIER/CODE',
supplier_name VARCHAR2(140) path 'HEADER/SUPPLIER/NAME' ,
gst_number VARCHAR2(30 ) path 'HEADER/SUPPLIER/GST_NUMBER',
contact_name VARCHAR2(140 ) path 'HEADER/SUPPLIER/CONTACT_NAME',
contact_phone VARCHAR2(23 ) path 'HEADER/SUPPLIER/CONTACT_PHONE',
contact_email VARCHAR2(100) path 'HEADER/SUPPLIER/CONTACT_EMAIL',
contact_fax VARCHAR2(23 ) path 'HEADER/SUPPLIER/CONTACT_FAX',
supp_site_id NUMBER path 'HEADER/SUPPLIER/SITES/SITE/ID',
supp_site_name VARCHAR2(140) path 'HEADER/SUPPLIER/SITES/SITE/NAME',
supp_site_phone VARCHAR2(23) path 'HEADER/SUPPLIER/SITES/SITE/PHONE',
supp_sit_phone_ext VARCHAR2(4 ) path 'HEADER/SUPPLIER/SITES/SITE/PHONE_EXTENSION',
supp_site_fax VARCHAR2(23 ) path 'HEADER/SUPPLIER/SITES/SITE/FAX',
supp_site_email VARCHAR2(100 ) path 'HEADER/SUPPLIER/SITES/SITE/EMAIL',
supp_site_add_line1 VARCHAR2(254 ) path 'HEADER/SUPPLIER/SITES/SITE/ADDRESS_LINE1',
supp_site_add_line2 VARCHAR2(35 ) path 'HEADER/SUPPLIER/SITES/SITE/ADDRESS_LINE2',
supp_site_add_line3 VARCHAR2(35 ) path 'HEADER/SUPPLIER/SITES/SITE/ADDRESS_LINE3',
supp_site_country_code VARCHAR2(2 ) path 'HEADER/SUPPLIER/SITES/SITE/COUNTRY_CODE',
supp_site_province VARCHAR2(25 ) path 'HEADER/SUPPLIER/SITES/SITE/PROVINCE',
supp_site_state VARCHAR2(25 ) path 'HEADER/SUPPLIER/SITES/SITE/STATE',
supp_site_city VARCHAR2(25 ) path 'HEADER/SUPPLIER/SITES/SITE/CITY',
supp_site_area_code VARCHAR2(10 ) path 'HEADER/SUPPLIER/SITES/SITE/AREA_CODE',
supp_site_zip VARCHAR2(20 ) path 'HEADER/SUPPLIER/SITES/SITE/ZIP',
supp_site_region_code VARCHAR2(3 ) path 'HEADER/SUPPLIER/SITES/SITE/REGION_CODE',
user_code VARCHAR2(16 ) path 'HEADER/USER/CODE',
user_name VARCHAR2(25 ) path 'HEADER/USER/NAME',
user_org_name VARCHAR2(95 ) path 'HEADER/USER/ORGANISATION_NAME',
currency_code VARCHAR2(3 ) path 'HEADER/FUND_COMMIT_AMOUNT/CURRENCY_CODE',
currency_rate NUMBER path 'HEADER/FUND_COMMIT_AMOUNT/CURRENCY_RATE',
currency_rate_date VARCHAR2(24) path 'HEADER/FUND_COMMIT_AMOUNT/CURRENCY_RATE_DATE',
currency_rate_type VARCHAR2(5 ) path 'HEADER/FUND_COMMIT_AMOUNT/CURRENCY_RATE_TYPE',
currency_amount NUMBER path 'HEADER/FUND_COMMIT_AMOUNT/CURRENCY_AMOUNT',
tx_field_2 VARCHAR2(17 ) path 'HEADER/PERIOD_CONTRACT/CODE',
agency_code VARCHAR2(6 ) path 'HEADER/PERIOD_CONTRACT/AGENCY_CODE',
admin_fee_sgd NUMBER path 'HEADER/PERIOD_CONTRACT/ADMIN_FEE_SGD_AMOUNT' ,
buyer_orgn_code VARCHAR2(5 ) path 'HEADER/BUYER/ORGANISATION_CODE',
buyer_orgn_name VARCHAR2(95 ) path 'HEADER/BUYER/ORGANISATION_NAME',
buyer_name VARCHAR2(80 ) path 'HEADER/BUYER/NAME',
buyer_phone VARCHAR2(23 ) path 'HEADER/BUYER/PHONE',
buyer_fax VARCHAR2(23 ) path 'HEADER/BUYER/FAX',
buyer_email VARCHAR2(100 ) path 'HEADER/BUYER/EMAIL',
ao_code VARCHAR2(16 ) path 'HEADER/APPROVING_OFFICERS/APPROVING_OFFICER/CODE',
ao_name VARCHAR2(40 ) path 'HEADER/APPROVING_OFFICERS/APPROVING_OFFICER/NAME',
items XMLTYPE path 'ITEMS'
) x1,
XMLTABLE('/ITEMS/ITEM'
passing x1.items
columns
line_no VARCHAR2(5) path 'LINE_NUMBER',
line_status VARCHAR2(15) path 'STATUS',
line_status_date VARCHAR2(24) path 'STATUS_DATE',
line_description VARCHAR2(500) path 'DESCRIPTION',
unit_of_measure VARCHAR2(3) path 'UNIT_OF_MEASURE',
line_qty NUMBER path 'QUANTITY',
line_type VARCHAR2(20) path 'LINE_TYPE',
unit_price NUMBER path 'UNIT_PRICE',
line_total_amount NUMBER path 'TOTAL_AMOUNT',
material_master_code VARCHAR2(20) path 'MATERIAL_MASTER_CODE',
material_group_code VARCHAR2(10) path 'MATERIAL_GROUP_CODE',
item_category_code VARCHAR2(18) path 'ITEM_CATEGORY_CODE',
line_admin_fee_sgd_amt NUMBER path 'ADMIN_FEE_SGD_AMOUNT',
instruction_supplier VARCHAR2(400) path 'INSTRUCTION_TO_SUPPLIER',
period_contract_line_no NUMBER path 'PERIOD_CONTRACT_LINE_NUMBER',
goods_inspect_flag VARCHAR2(1) path 'GOODS_INSPECT_FLAG',
pr_code VARCHAR2(17) path 'PURCHASE_REQUEST/CODE',
pr_line_number VARCHAR2(5) path 'PURCHASE_REQUEST/LINE_NUMBER',
nato_stock_number VARCHAR2(14) path 'PART_NUMBER_INFORMATION/NATO_STOCK_NUMBER',
manufacturer_part_no VARCHAR2(32) path 'PART_NUMBER_INFORMATION/MANUFACTURE_PART_NUMBER',
part_number VARCHAR2(200) path 'PART_NUMBER_INFORMATION/PART_NUMBER',
cage_code VARCHAR2(10) path 'PART_NUMBER_INFORMATION/CAGE_CODE',
cage_name VARCHAR2(140) path 'PART_NUMBER_INFORMATION/CAGE_NAME',
item_condition VARCHAR2(1) path 'PART_NUMBER_INFORMATION/ITEM_CONDITION' ,
minimum_shelf_life NUMBER path 'PART_NUMBER_INFORMATION/MINIMUM_SHELF_LIFE',
shelf_life_remaining VARCHAR2(3) path 'PART_NUMBER_INFORMATION/SHELF_LIFE_REMAINING',
cert_of_conformance VARCHAR2(1000) path 'PART_NUMBER_INFORMATION/CERTIFICATE_OF_CONFORMANCE',
export_license VARCHAR2(3) path 'PART_NUMBER_INFORMATION/EXPORT_LICENSE',
locations XMLTYPE path 'LOCATIONS'
)x2,
XMLTABLE('/LOCATIONS/LOCATION'
passing x2.locations
columns
line_location_no NUMBER path 'LINE_NUMBER',
line_loc_status VARCHAR2(15) path 'STATUS',
line_loc_status_date VARCHAR2(24) path 'STATUS_DATE',
line_loc_qty NUMBER path 'QUANTITY',
delivery_destination VARCHAR2(1000) path 'DELIVERY_DESTINATION',
delivery_date VARCHAR2(24) path 'DELIVERY_DATE',
delivery_terms VARCHAR2(3) path 'DELIVERY_TERMS',
port_of_origin VARCHAR2(150) path 'PORT_OF_ORIGIN',
recipient_code VARCHAR2(16 ) path 'RECIPIENT/CODE',
recipient_name VARCHAR2(40 ) path 'RECIPIENT/NAME',
recipient_phone VARCHAR2(23 ) path 'RECIPIENT/PHONE',
recipient_email VARCHAR2(100 ) path 'RECIPIENT/EMAIL',
distributions XMLTYPE path 'DISTRIBUTIONS'
)x3,
XMLTABLE('/DISTRIBUTIONS/DISTRIBUTION'
passing x3.distributions
columns
dist_line_no NUMBER path 'LINE_NUMBER',
dist_line_status VARCHAR2(15) path 'STATUS',
dist_line_status_date VARCHAR2(24) path 'STATUS_DATE',
dist_line_qty NUMBER path 'QUANTITY',
chart_of_account VARCHAR2(420) path 'CHART_OF_ACCOUNT',
project_distribution VARCHAR2(4000) path 'PROJECT_DISTRIBUTION'
)x4;
end;As there is change in requirement now I need to read the multiple supplier sites at the header level. Current this is my structure please give an idea how to read the mulitple sites as one record, probably i can increase the supplier site columns at table level so as to capture second site level information.
But if in case if i receive that time it should not fail please provide some good solution for this issue.
Thanks in advance for your help.
Regards
NagendraHi odie,
Thanks for your response. But here my supplier site will always be maxiumum 2 times and minimum 1 time. My thinking is to fit this one in the existing code by repeating the supplier site only like this
supp_site_id NUMBER path 'HEADER/SUPPLIER/SITES/SITE/ID',
supp_site_name VARCHAR2(140) path 'HEADER/SUPPLIER/SITES/SITE/NAME',
supp_site_phone VARCHAR2(23) path 'HEADER/SUPPLIER/SITES/SITE/PHONE',
supp_sit_phone_ext VARCHAR2(4 ) path 'HEADER/SUPPLIER/SITES/SITE/PHONE_EXTENSION',
supp_site_fax VARCHAR2(23 ) path 'HEADER/SUPPLIER/SITES/SITE/FAX',
supp_site_email VARCHAR2(100 ) path 'HEADER/SUPPLIER/SITES/SITE/EMAIL',
supp_site_add_line1 VARCHAR2(254 ) path 'HEADER/SUPPLIER/SITES/SITE/ADDRESS_LINE1',
supp_site_add_line2 VARCHAR2(35 ) path 'HEADER/SUPPLIER/SITES/SITE/ADDRESS_LINE2',
supp_site_add_line3 VARCHAR2(35 ) path 'HEADER/SUPPLIER/SITES/SITE/ADDRESS_LINE3',
supp_site_country_code VARCHAR2(2 ) path 'HEADER/SUPPLIER/SITES/SITE/COUNTRY_CODE',
supp_site_province VARCHAR2(25 ) path 'HEADER/SUPPLIER/SITES/SITE/PROVINCE',
supp_site_state VARCHAR2(25 ) path 'HEADER/SUPPLIER/SITES/SITE/STATE',
supp_site_city VARCHAR2(25 ) path 'HEADER/SUPPLIER/SITES/SITE/CITY',
supp_site_area_code VARCHAR2(10 ) path 'HEADER/SUPPLIER/SITES/SITE/AREA_CODE',
supp_site_zip VARCHAR2(20 ) path 'HEADER/SUPPLIER/SITES/SITE/ZIP',
supp_site_region_code VARCHAR2(3 ) path 'HEADER/SUPPLIER/SITES/SITE/REGION_CODE',
supp_site_id2 NUMBER path 'HEADER/SUPPLIER/SITES/SITE/ID',
supp_site_name2 VARCHAR2(140) path 'HEADER/SUPPLIER/SITES/SITE/NAME',
supp_site_phone2 VARCHAR2(23) path 'HEADER/SUPPLIER/SITES/SITE/PHONE',
supp_sit_phone_ext2 VARCHAR2(4 ) path 'HEADER/SUPPLIER/SITES/SITE/PHONE_EXTENSION',
supp_site_fax2 VARCHAR2(23 ) path 'HEADER/SUPPLIER/SITES/SITE/FAX',
supp_site_email2 VARCHAR2(100 ) path 'HEADER/SUPPLIER/SITES/SITE/EMAIL',
supp_site_add_line1_2 VARCHAR2(254 ) path 'HEADER/SUPPLIER/SITES/SITE/ADDRESS_LINE1',
supp_site_add_line2_2 VARCHAR2(35 ) path 'HEADER/SUPPLIER/SITES/SITE/ADDRESS_LINE2',
supp_site_add_line3_2 VARCHAR2(35 ) path 'HEADER/SUPPLIER/SITES/SITE/ADDRESS_LINE3',
supp_site_country_code_2 VARCHAR2(2 ) path 'HEADER/SUPPLIER/SITES/SITE/COUNTRY_CODE',
supp_site_province_2 VARCHAR2(25 ) path 'HEADER/SUPPLIER/SITES/SITE/PROVINCE',
supp_site_state_2 VARCHAR2(25 ) path 'HEADER/SUPPLIER/SITES/SITE/STATE',
supp_site_city_2 VARCHAR2(25 ) path 'HEADER/SUPPLIER/SITES/SITE/CITY',
supp_site_area_code_2 VARCHAR2(10 ) path 'HEADER/SUPPLIER/SITES/SITE/AREA_CODE',
supp_site_zip_2 VARCHAR2(20 ) path 'HEADER/SUPPLIER/SITES/SITE/ZIP',
supp_site_region_code_2 VARCHAR2(3 ) path 'HEADER/SUPPLIER/SITES/SITE/REGION_CODE',As this table I am being used in many areas, it will be problem for me if try to go for different levels of tables. Or else can it be possible to read only once
I mean only the first in the xml tags and leave the second xml. As there is not much significant for the second one.
I appreciate your ideas on this, as the structure we are following is to rigid so I don't have much options to explore, please provide me your inputs in this context.
Thanks for your help.
Regards
Nagendra
Edited by: 838961 on Jul 13, 2011 1:43 AM -
Issue in calling a web service from Apps instance
Hi ,
I have created a procedure to call a function which gives response by calling a web service URL.
Requirement is,
While calling this procedure , the response data has been stored in the table. This is working fine in the back end.
Now , i call the same through concurrenet program . It is also getting stored but partially.. The exact data is missing ..other default tags are displayed in the column.
PROCEUDRE:
create or replace procedure cv_test_GetCityWeather_PROC(cityName in varchar2, country in varchar2 ,errbuf OUT nocopy VARCHAR2,retcode OUT nocopy VARCHAR2) is
xmlResponse XmlType;
begin
xmlResponse := CV_Test_GetCityWeather(cityName,country);
insert into xx_cv_test values(xmlResponse);
fnd_file.put_line(fnd_file.log, 'hghghgh');
EXCEPTION
WHEN OTHERS THEN
retcode := 'insert failed';
fnd_file.put_line(fnd_file.log, 'response of the request is ' );
--dbms_output.put_line('xmlResponse ' ||xmlResponse);
end cv_test_getCityweather_proc;
FUNCTION
/*<TOAD_FILE_CHUNK>*/
CREATE OR REPLACE function APPS.CV_Test_GetCityWeather( cityName varchar2, country varchar2 ) return XmlType is
--// URL to call
SOAP_URL constant varchar2(1000) := 'http://www.webservicex.net/globalweather.asmx';
--// SOAP envelope template, containing $ substitution variables
SOAP_ENVELOPE constant varchar2(32767) :=
'<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://www.webserviceX.NET">
<soapenv:Header/>
<soapenv:Body>
<web:GetWeather>
<web:CityName>$CITY</web:CityName>
<web:CountryName>$COUNTRY</web:CountryName>
</web:GetWeather>
</soapenv:Body>
</soapenv:Envelope>';
--// we'll identify ourselves using an IE9/Windows7 generic browser signature
C_USER_AGENT constant varchar2(4000) := 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)';
--// these variables need to be set if web access
--// is via a proxy server
proxyServer varchar2(20) default null;
proxyUser varchar2(20) default null;
proxyPass varchar2(20) default null;
--// our local variables
soapEnvelope varchar2(32767);
proxyURL varchar2(4000);
request utl_http.req;
response utl_http.resp;
buffer varchar2(32767);
soapResponse clob;
xmlResponse XmlType;
eof boolean;
begin
--// create the SOAP envelope
soapEnvelope := replace( SOAP_ENVELOPE, '$CITY', cityName );
soapEnvelope := replace( soapEnvelope, '$COUNTRY', country );
--// our "browser" settings
utl_http.set_response_error_check( true );
utl_http.set_detailed_excp_support( true );
utl_http.set_cookie_support( true );
utl_http.set_transfer_timeout( 10 );
utl_http.set_follow_redirect( 3 );
utl_http.set_persistent_conn_support( true );
--// configure for web proxy access if applicable
if proxyServer is not null then
proxyURL := 'http://'||proxyServer;
if (proxyUser is not null) and (proxyPass is not null) then
proxyURL := Replace( proxyURL, 'http://', 'http://'||proxyUser||':'||proxyPass||'@' );
end if;
utl_http.set_proxy( proxyURL, null );
end if;
--// make the POST call to the web service
request := utl_http.begin_request( SOAP_URL, 'POST', utl_http.HTTP_VERSION_1_1 );
utl_http.set_header( request, 'User-Agent', C_USER_AGENT );
utl_http.set_header( request, 'Content-Type', 'text/xml; charset=utf-8' );
utl_http.set_header( request, 'Content-Length', length(soapEnvelope) );
utl_http.set_header( request, 'SoapAction', 'http://www.webserviceX.NET/GetWeather' );
utl_http.write_text( request, soapEnvelope );
--// read the web service HTTP response
response := utl_http.get_response( request );
dbms_lob.CreateTemporary( soapResponse, true );
eof := false;
loop
exit when eof;
begin
utl_http.read_line( response, buffer, true );
if length(buffer) > 0 then
dbms_lob.WriteAppend(
soapResponse,
length(buffer),
buffer
end if;
exception when utl_http.END_OF_BODY then
eof := true;
end;
end loop;
utl_http.end_response( response );
--// as the SOAP responds with XML, we convert
--// the response to XML
xmlResponse := XmlType( soapResponse );
--dbms_lob.FreeTemporary( soapResponse );
--insert into xx_cv_test values(xmlResponse);
return( xmlResponse );
exception when OTHERS then
if soapResponse is not null then
dbms_lob.FreeTemporary( soapResponse );
end if;
raise;
end;
EXECUTION:
select cv_test_GetCityWeather( 'Cape Town', 'South Africa' ) from dual
Result is,
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetWeatherResponse xmlns="http://www.webserviceX.NET">
<GetWeatherResult><?xml version="1.0" encoding="utf-16"?><CurrentWeather> <Location>Cape Town, Cape Town International Airport, South Africa (FACT) 33-59S 018-36E 0M</Location> <Time>May 28, 2013 - 03:00 AM EDT / 2013.05.28 0700 UTC</Time> <Wind> from the NNW (330 degrees) at 7 MPH (6 KT) (direction variable):0</Wind> <Visibility> 4 mile(s):0</Visibility> <SkyConditions> mostly cloudy</SkyConditions> <Temperature> 57 F (14 C)</Temperature> <DewPoint> 53 F (12 C)</DewPoint> <RelativeHumidity> 87%</RelativeHumidity> <Pressure> 30.03 in. Hg (1017 hPa)</Pressure> <Status>Success</Status></CurrentWeather></GetWeatherResult>
</GetWeatherResponse>
</soap:Body>
</soap:Envelope>
While running Concurrent Program, by providing PARAMETERS : Cape Town, South Africa,
the result is ,
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetWeatherResponse xmlns="http://www.webserviceX.NET">
<GetWeatherResult>Data Not Found</GetWeatherResult>
</GetWeatherResponse>
</soap:Body>
</soap:Envelope>
Why the outputs are different for the same procedure..
Anybody , Please help me to fix this issue.
Thanks
Winskyduplicate post
Please see
Calling webservice from PLSQL
Please confirm are you the one who post the above thread
;) AppsMAsti :)
sharing is Caring -
Item Conversion Template Issue for Oracle Migration - Copy functionality
Hi,
I am working on Migration project which is from Radius ERP to Oracle 11.5.10.2.
Currently working on Item Conversion. This Item conversion having the fileds like (ORGANIZATION_ID,SEGMENT1,DESCRIPTION,ITEM_TYPE,COST_OF_SALES_ACCOUNT,SALES_ACCOUNT,ATTRIBUTE_CATEGORY,ATTRIBUTE1,ATTRIBUTE2,ATTRIBUTE3,ATTRIBUTE4,ATTRIBUTE5,ATTRIBUTE6,ATTRIBUTE7,ATTRIBUTE8,ATTRIBUTE9,ATTRIBUTE10,ATTRIBUTE11,ATTRIBUTE12,ATTRIBUTE13,ATTRIBUTE14,ATTRIBUTE15,GLOBAL_ATTRIBUTE10,REF_INVENTORY_ITEM_ID,REF_ORGANIZATION_ID).
I have validated those fields and loaded into interfacing to Oracle Successfully in the master Org and Validated through Frontend.
when I close the form, I will be receiving the below warning message and telling that Template id needs to be assign to the item before assigning item to the Org. The message is showing like
"*You have not applied a template to this item, please apply a template before assigning this item to an ORG.*"
Please find the below package which I wrote for this conversion requirement.
The customer is saying like need to achieve the copy functionality based on the "REF_INVENTORY_ITEM_ID and REF_ORGANIZATION_ID".
The Issue is am not able to handle the copy functionality and getting above message. kindly refer the package and suggest me where i am doing the mistake. Its high priority issue for me.
Thanks in advance.
CREATE OR REPLACE PACKAGE APPS.xxxx_inv_items_conv_pkg
AS
PROCEDURE xxx_item_conversion_proc (
errbuf OUT VARCHAR2,
retcode OUT VARCHAR2,
p_org_id IN NUMBER,
-- p_commit_point IN NUMBER,
p_load_code IN VARCHAR2
IS
<<Local Variables Declaration>> <<For space limit deleted these variables>>
CURSOR cur_item_master (pc_org_code VARCHAR2)
IS
SELECT itemstg.*
FROM xxx_inv_system_items_stg itemstg
WHERE itemstg.organization_id = pc_org_code
AND itemstg.status_flag IS NULL;
CURSOR cur_item_master_dup (pc_org_code VARCHAR2)
IS
SELECT itemstg.segment1, itemstg.organization_id
FROM xxx_inv_system_items_stg itemstg
WHERE itemstg.ROWID <
(SELECT MAX (b.ROWID)
FROM xxx_inv_system_items_stg b
WHERE b.segment1 = itemstg.segment1
AND b.organization_id = itemstg.organization_id
AND b.organization_id = pc_org_code
AND itemstg.status_flag IS NULL
AND b.status_flag IS NULL);
BEGIN
IF p_load_code = 'Insert'
THEN
l_transaction_type := 'CREATE'; -- Default Value in I/F Table
ELSIF p_load_code = 'Update'
THEN
l_transaction_type := 'UPDATE'; -- Default Value in I/F Table
END IF;
DBMS_OUTPUT.put_line ( 'Validation Starts At :'
|| TO_CHAR (SYSDATE, 'DD-MON-YYYY HH24:MI:SS')
--Checking for Duplicate Records items
BEGIN
UPDATE xxx_inv_system_items_stg a
SET a.status_flag = 'E',
a.error_message = 'Duplicate Record'
WHERE a.ROWID >
ANY (SELECT b.ROWID
FROM xxx_inv_system_items_stg b
WHERE a.segment1 = b.segment1
AND a.organization_id = b.organization_id)
AND a.organization_id = p_org_id
AND a.status_flag IS NULL;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line ('Exception in updating duplicates'
|| SQLERRM
END;
DBMS_OUTPUT.put_line ('CheckPoint: Duplicate Record');
BEGIN
SELECT organization_id
INTO l_organization_id
FROM org_organization_definitions
WHERE organization_id = p_org_id;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
DBMS_OUTPUT.PUT_LINE(p_org_id||' Org Does Not Exist');
-- p_retcode := '2';
WHEN OTHERS
THEN
DBMS_OUTPUT.PUT_LINE('Exception in Getting Org Id'||'Cannot Proceed');
-- p_retcode := '2';
END ;
DBMS_OUTPUT.put_line ('CheckPoint: Orgcode' || l_organization_id);
/* IF p_retcode = '2'
THEN
RETURN;
END IF;*/
--Block : Setting Master and Validation Orgs Flags
BEGIN
SELECT DECODE (master_organization_id, l_organization_id, 'Y', 'N'),
master_organization_id
INTO l_master_org,
l_master_org_id
FROM mtl_parameters
WHERE organization_id = l_organization_id;
EXCEPTION
WHEN OTHERS
THEN
l_master_org := 'N';
l_master_org_id := NULL;
DBMS_OUTPUT.PUT_LINE(p_org_id||' Org Does Not Exist');
END ;
DBMS_OUTPUT.put_line ('master_organization_id');
SELECT fnd_profile.VALUE ('USER_ID')
INTO l_user_id
FROM DUAL;
-- Block : Set the SET_PROCESS_ID
l_set_process_id := l_organization_id;
l_insert_count := 0;
LOOP
BEGIN
SELECT COUNT (segment1)
INTO l_insert_count
FROM mtl_system_items_interface
WHERE set_process_id = l_set_process_id
AND transaction_type = l_transaction_type
AND process_flag = 1;
EXCEPTION
WHEN OTHERS
THEN
l_insert_count := 0;
END;
EXIT WHEN l_insert_count = 0;
l_set_process_id := l_set_process_id + 10;
END LOOP;
DBMS_OUTPUT.put_line ('SET PROCESS ID -l_insert_count ' || l_insert_count);
IF p_load_code = 'Insert'
THEN
BEGIN
FOR recitem_data IN cur_item_master_dup (p_org_id)
LOOP
UPDATE xxx_inv_system_items_stg
SET status_flag = l_processed_flag,
error_message = l_error_message
WHERE segment1 = recitem_data.segment1
AND organization_id = recitem_data.organization_id
AND status_flag IS NULL;
COMMIT;
END LOOP;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line ( 'Update of Duplicates Failed : '
|| SQLCODE
|| '--'
|| SQLERRM
END ;
END IF;
FOR recitem_data IN cur_item_master (p_org_id)
LOOP
<<Local Variables Declaration>> <<For space limit deleted these variables>>
IF p_load_code = 'Update'
THEN
l_error_message := 'Update Mode' || l_error_delimiter;
END IF;
--l_count := -1;
BEGIN
DBMS_OUTPUT.put_line ('CheckPoint: ItemValidationStart');
SELECT DISTINCT inventory_item_id,
restrict_subinventories_code,
restrict_locators_code
INTO l_inventory_item_id,
l_restrict_subinventories_code,
l_restrict_locators_code
FROM apps.mtl_system_items_b msi
WHERE msi.organization_id = l_organization_id
AND msi.segment1 = UPPER (recitem_data.segment1);
EXCEPTION
WHEN NO_DATA_FOUND
THEN
l_count := 0;
-- l_processed_flag := 'F';
DBMS_OUTPUT.put_line ('inventory_item_id - AFTER MAIN LOOP' || l_inventory_item_id||'-'||l_processed_flag);
DBMS_OUTPUT.put_line ('inventory_item_id - AFTER MAIN LOOP' || l_inventory_item_id||'-'||recitem_data.ref_inventory_item_id);
WHEN OTHERS
THEN
l_count := -1;
-- l_processed_flag := 'F';
DBMS_OUTPUT.put_line ('inventory_item_id - AFTER MAIN LOOP' || l_inventory_item_id||'-'||l_processed_flag);
END ;
DBMS_OUTPUT.put_line ('inventory_item_id - AFTER MAIN LOOP'||recitem_data.ref_inventory_item_id);
IF l_count = -1
THEN
l_processed_flag := 'F';
l_error_message :=
l_error_message
|| 'Exception - Checking Item already Present'
|| l_error_delimiter;
DBMS_OUTPUT.put_line ('Exception - Checking Item already Present'||l_processed_flag);
ELSIF (l_count > 0 AND p_load_code = 'Insert')
THEN
l_processed_flag := 'F';
l_error_message :=
l_error_message
|| 'Item Already Exists In '
|| p_org_id
|| ' Organization '
|| l_error_delimiter;
DBMS_OUTPUT.put_line ('Exception - Checking Item already Present1'||l_processed_flag);
ELSIF (l_count = 0 AND p_load_code = 'Update')
THEN
l_processed_flag := 'F';
l_error_message :=
l_error_message
|| 'Item Not Present In '
|| p_org_id
|| ' Organization '
|| l_error_delimiter;
DBMS_OUTPUT.put_line ('Exception - Checking Item already Present2'||l_processed_flag);
END IF;
BEGIN
SELECT count(*)
INTO l_seg_count
FROM apps.mtl_system_items_b msi
WHERE msi.organization_id = l_organization_id
AND msi.segment1 = UPPER (recitem_data.segment1);
EXCEPTION
WHEN NO_DATA_FOUND
THEN
l_seg_count := 0;
l_processed_flag:='F';
l_error_message :=
l_error_message
|| 'Item Not Present In Oracle'
|| p_org_id
|| ' Organization '
|| l_error_delimiter;
DBMS_OUTPUT.put_line ('inventory_item_id - l_seg_count ' ||l_seg_count||'-'||l_processed_flag );
WHEN OTHERS
THEN
l_seg_count := -1;
l_processed_flag:='F';
l_error_message :=
l_error_message
|| 'Item Not Present In Oracle'
|| p_org_id
|| ' Organization '
|| l_error_delimiter;
END ;
IF p_load_code = 'Insert'
THEN
IF l_organization_id != l_master_org_id
THEN
BEGIN
SELECT COUNT (1)
INTO l_org_item_count
FROM apps.mtl_system_items_b msi
WHERE msi.organization_id = l_master_org_id
AND msi.segment1 = UPPER (recitem_data.segment1);
EXCEPTION
WHEN NO_DATA_FOUND
THEN
l_org_item_count := 0;
DBMS_OUTPUT.put_line ('l_org_item_count ' ||l_org_item_count||'-'||l_processed_flag );
WHEN OTHERS
THEN
l_org_item_count := -1;
END ;
IF l_org_item_count = -1
THEN
l_processed_flag := 'F';
l_error_message :=
l_error_message
|| 'Exception - Checking Item in Master '
|| l_error_delimiter;
ELSIF l_org_item_count = 0
THEN
l_processed_flag := 'F';
l_error_message :=
l_error_message
|| 'Item Does Not Exist in Master '
|| l_error_delimiter;
END IF;
END IF;
END IF;
DBMS_OUTPUT.put_line ( 'CheckPoint: Iteminmasterorg'
|| l_org_item_count
IF (recitem_data.description IS NULL AND p_load_code = 'Insert')
THEN
l_processed_flag := 'F';
l_error_message :=
l_error_message || 'Description is NULL' || l_error_delimiter;
END IF;
IF (recitem_data.sales_account IS NOT NULL)
THEN
BEGIN
SELECT code_combination_id
INTO l_sales_account
FROM gl_code_combinations_kfv
WHERE code_combination_id= recitem_data.sales_account;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
-- l_processed_flag := 'F'; --QUESTION
l_error_message :=
l_error_message
|| 'Sales Account Not Setup '
|| l_error_delimiter;
DBMS_OUTPUT.put_line ( 'CheckPoint: Salesacct_Validation'
|| l_sales_account||'-'||l_processed_flag
WHEN OTHERS
THEN
l_processed_flag := 'F';
l_error_message :=
l_error_message
|| 'Sales Account Exception '
|| SQLERRM
|| l_error_delimiter;
DBMS_OUTPUT.put_line ( 'CheckPoint: Salesacct_Validation'
|| l_sales_account||'-'||l_processed_flag
END ;
END IF;
IF (recitem_data.cost_of_sales_account IS NOT NULL)
THEN
BEGIN
SELECT code_combination_id
INTO l_cost_of_sales_account
FROM gl_code_combinations_kfv
WHERE code_combination_id =
recitem_data.cost_of_sales_account;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
l_processed_flag := 'F';
l_error_message :=
l_error_message
|| 'COGS Account Not Setup '
|| l_error_delimiter;
DBMS_OUTPUT.put_line ( 'l_cost_of_sales_account'
|| l_cost_of_sales_account||'-'||l_processed_flag
WHEN OTHERS
THEN
l_processed_flag := 'F';
l_error_message :=
l_error_message
|| 'COGS Account Exception '
|| SQLERRM
|| l_error_delimiter;
DBMS_OUTPUT.put_line ( 'l_cost_of_sales_account'
|| l_cost_of_sales_account||'-'||l_processed_flag
END check_cogs_account;
END IF;
BEGIN
select distinct organization_code
into l_ref_org_code
from org_organization_definitions
where organization_id = recitem_data.ref_organization_id ;
EXCEPTION
WHEN OTHERS THEN
l_ref_org_code:= NULL;
l_processed_flag:='F';
l_error_message :=
l_error_message
|| 'Reference Org Not Present'
|| p_org_id
|| ' Organization '
|| l_error_delimiter ;
DBMS_OUTPUT.put_line ('l_ref_org_code'|| l_ref_org_code||'-'||l_processed_flag);
END;
BEGIN
select concatenated_segments
into l_ref_inventory_item_code
from mtl_system_items_kfv
where inventory_item_id = recitem_data.ref_inventory_item_id
and organization_id = recitem_data.ref_organization_id ;
EXCEPTION
WHEN OTHERS THEN
l_ref_inventory_item_code :=NULL;
l_processed_flag:='F';
l_error_message :=
l_error_message
|| 'Reference Item Not Present'
|| p_org_id
|| ' Organization '
|| l_error_delimiter;
DBMS_OUTPUT.put_line ('l_ref_inventory_item_code'|| l_ref_inventory_item_code||'-'||l_processed_flag);
END;
IF (l_master_org = 'N' AND p_load_code = 'Insert')
THEN
BEGIN
SELECT count(*)
INTO l_description_count
FROM mtl_system_items_tl
WHERE organization_id = l_master_org_id
AND inventory_item_id =
(SELECT inventory_item_id
FROM mtl_system_items_b
WHERE organization_id = l_master_org_id
AND segment1 = recitem_data.segment1);
END ;
IF l_description_count > 0 THEN
l_processed_flag:='F';
l_error_message :=
l_error_message
|| 'Item Description Not Present'
|| p_org_id
|| ' Organization '
|| l_error_delimiter;
END IF;
END IF;
IF l_processed_flag = 'S'
THEN
BEGIN
INSERT INTO mtl_system_items_interface
(organization_id,
segment1,
description,
ITEM_TYPE,
COST_OF_SALES_ACCOUNT,
SALES_ACCOUNT,
attribute_category,
set_process_id,
transaction_type,
process_flag,
copy_organization_code,
copy_item_number,
creation_date,
created_by,
last_updated_by,
last_update_date
--attribute_category
, attribute1
, attribute2
,attribute3
,attribute4
,attribute5
,attribute6
,attribute7
,attribute8
,attribute9
,attribute10
,attribute11
,attribute12
,attribute13
,attribute14
,attribute15
,global_attribute10
VALUES (l_organization_id,
recitem_data.segment1,
recitem_data.description,
recitem_data.ITEM_TYPE,
recitem_data.COST_OF_SALES_ACCOUNT,
recitem_data.SALES_ACCOUNT,
recitem_data.ATTRIBUTE_CATEGORY,
l_set_process_id,
l_transaction_type, --,l_transaction_type
l_process_flag,
l_ref_org_code,
l_ref_inventory_item_code,
SYSDATE, l_user_id,
l_user_id, SYSDATE
-- l_attribute_category
,recitem_data.attribute1
,recitem_data.attribute2
,recitem_data.attribute3
,recitem_data.attribute4
,recitem_data.attribute5
,recitem_data.attribute6
,recitem_data.attribute7
, recitem_data.attribute8
,recitem_data.attribute9
, recitem_data.attribute10
,recitem_data.attribute11
,recitem_data.attribute12
,recitem_data.attribute13
,recitem_data.attribute14
,recitem_data.attribute15
, substr(recitem_data.global_attribute10,1,length(recitem_data.global_attribute10)-1) --recitem_data.global_attribute10
l_insert_count := l_insert_count + 1;
/* IF (l_insert_count = NVL (p_commit_point, 10000))
THEN
-- l_set_process_id := l_set_process_id + 10; -- REVERT BACK CHANGE
l_insert_count := 0;
END IF;
EXCEPTION
WHEN OTHERS
THEN
l_processed_flag := 'F';
l_error_message :=
l_error_message
|| 'Error in Inserting Item '
|| SQLERRM
|| l_error_delimiter;
END ;
COMMIT;
DBMS_OUTPUT.put_line ('CheckPoint: Insertion Completed in Intfacetable');
END IF;
BEGIN
UPDATE xxx_inv_system_items_stg
SET status_flag = l_processed_flag,
error_message = l_error_message
WHERE segment1 = recitem_data.segment1
AND organization_id = recitem_data.organization_id
AND status_flag IS NULL;
COMMIT;
DBMS_OUTPUT.put_line ('Error Message'||l_error_message);
EXCEPTION
WHEN OTHERS
THEN
fnd_file.put_line (fnd_file.LOG,
'Error:Updating Item:'
|| SQLCODE
|| '-'
|| SQLERRM
END;
END LOOP; --FOR recitem_data IN cur_item_master
DBMS_OUTPUT.put_line ( 'Validation Ends At :'
|| TO_CHAR (SYSDATE, 'DD-MON-YYYY HH24:MI:SS')
DBMS_OUTPUT.put_line ('Number of records inserted into Table Successfully -->'|| l_insert_count);
END;
END xxxx_inv_items_conv_pkg;
Edited by: 896170 on Apr 12, 2013 11:58 PMIssue got solved... changed the PO line amount as:
<?xdoxslt:set_variable($_XDOCTX,'line_amt',xdoxslt:to_number(LINE_AMOUNT))?>
Reference :Syntax for 'to_number'
Regards
Manikanta Panigrahi -
On the use of VARCHAR2 vs. CHAR
I'm posting an e-mail thread that has been moving around in my organization, whith guidance from an Oracle representative.
The basic issue concerns the use of CHAR vs. VARCHAR2 when defining a table in Oracle.
I would like to get some comments from the community at large.
1. Business semantics should be represented in every aspect of a database, application, and design as far as I am concerned. Noteably, if the business rule at a corporate entity is clearly stated that when using Oracle the use of CHAR should be limited to those attribute implementations which have the following characteristics; a) The attribute may not be null, b) The attribute must have a character in each of the declared positions.
2. When the Visual Basic application began writing data to the CHAR columns in your application someone should have had a discussion with the developer to find out why this was happening. If the business semantics changed then the logical implemention of the business semantics should have changed as well. That the two were disconnected is not a problem with the CHAR type, it is a problem with the designer or the developer. The bottom line on this instance is that the column should have been defined as a VARCHAR2 data type since the business semantics no longer complied with the criteria set forth in the previous paragraph.
3. I think Oracle trys to load as much of the data from a table or index into shared memory, in this case the database block buffers, as it can in order to facilitate query operations. If Oracle has enough memory and can load a table or index into memory, it will do so. At the same time the database engine will move previously cached data out of memory to accommodate the new requirement.
-----Original Message-----
Thank you for the detail information on CHAR and VARCHAR2. It got me thinking with a DBA hat. I worked as a DBA before and I did use the CHAR type and I will share my experience/thought on CHAR.
I don't like to use the char type like Tom has advised because Oracle does not check to see if the value being inserted fills up the column or not which can lead to a problem. And there is no performance gain or save space in Oracle.
I worked as a DBA before, I used char type on the "must fill/always filled" column (pre DMDC). The application was written in VB with Oracle back end. At some point, VB started inserting values that are short of the column width and created a minor problem (it was supposed to be filled column). The problem was quickly identified and fixed, but it caused an issue.
I realize that I don’t want to define it as a "must fill/always filled" column if you can't enforce it by simply defining the char data type on a table and prevent possible issue in the future.
For a manager, in order to use the char properly, you have to hire client developers with Oracle experience or provide a basic Oracle training in order to avoid the problem I mentioned above in order to use the char type correctly.
I think you, Tom and I are saying the same thing really. Only difference is that Tom and I can not think of a good reason why anyone would like to indicate the business semantics using column type on the database, when it can lead to more work/issues.
In regards to wasted 25 million byes, why would Oracle load the table with 25 million rows? Shouldn't it use an index? Don't you have a serious problem if Oracle is loading table with the 25 million rows?
Just my two cents... : )
-----Original Message-----
May I beg to differ?
CHAR plays a vital role in the intuitive interpretation of a database schema. If designed correctly, the use of CHAR tells anyone who is in the know that this is a must fill column. Thus if a column is defined as CHAR(3) everyone should know that the column will always contain three characters. Defining the column as VARCHAR2(3) does not tell you anything about the data other than that the column may contain 0-3 characters.
Also, If a column is defined as CHAR the column should always be populated. One of the nice features of VARCHAR2 is that if the column is defined at the end of a table, there is no storage overhead until that column is actually populated. Thus if you have a table that has an identifier that is nine characters in length and will always be populated with nine characters, an attribute which describes the type of identifier which is contained in the first column and which must always be populated and is a must fill attribute, and another column which is descriptive and may vary in length or not be populated at time of insert; the following definition does not express the business semantics of the entity:
COL_CD VARCHAR2(9)
COL_TYP_TXT VARCHAR2(26)
COL_TYP_CD VARCHAR2(2)
The above definition also does not take advantage of inherent storage features of Oracle; notably there is a wasted place holder between COL_CD and COL_TYP_TXT and between COL_TYP_TXT and COL_TYP_CD. The next definition does take advantage of the storage features but does not represent the business semantics of the entity:
COL_CD VARCHAR2(9)
COL_TYP_CD VARCHAR2(2)
COL_TYP_TXT VARCHAR2(26)
The above definition does not waste space storing a place holder between COL_TYP_CD and COL_TYP_TXT if the COL_TYP_TXT may be null. The column separator will only be used when the column contains data. The below definition satisfies both the storage and business semantics issues:
COL_CD CHAR(9)
COL_TYP_CD CHAR(2)
COL_TYP_TXT VARCHAR2(26)
This may seem pedantic in nature until you consider the situation where there are 25 million rows in the table represented by the above entity. If each row has a NULL COL_TYP_TXT value then the first example wasted 25 million bytes of storage and 25 million bytes of memory if the full table is loaded into memory. This is an issue which cannot be ignored in high volume databases.
You may wish to know why it is important to define a must fill/always fill column as a CHAR to express the business semantics of an attribute. I can't give a definitive answer to that other than to say that it is just good database manners.
So please, continue to use CHAR when the shoe fits. Don't throw something away that has use just because it is not popular or in the mode.
Also, if I am mistaken in any of the above, please feel free to educate me.
Thanks.
-----Original Message-----
Subject: RE: Oracle on the use of VARCHAR2 vs. CHAR
Ignore if you already got this. This is just FYI.
-----Original Message-----
Below is a detailed answer to your VARCHAR2 or CHAR questions from our Database expert Tom Kyte. The short answer is VARCHAR2 is what you want to use. If you have any questions or want to discuss this in more detail let me know.
A CHAR datatype and VARCHAR2 datatype are stored identically (eg: the word 'WORD' stored in a CHAR(4) and a varchar2(4) consume exactly the same amount of space on disk, both have leading byte counts).
The difference between a CHAR and a VARCHAR is that a CHAR(n) will ALWAYS be N bytes long, it will be blank padded upon insert to ensure this. A varchar2(n) on the other hand will be 1 to N bytes long, it will NOT be blank padded.
Using a CHAR on a varying width field can be a pain due to the search semantics of CHAR.
Consider the following examples:
ops$tkyte@8i> create table t ( x char(10) ); Table created.
ops$tkyte@8i> insert into t values ( 'Hello' );
1 row created.
ops$tkyte@8i> select * from t where x = 'Hello';
X
Hello
ops$tkyte@8i> variable y varchar2(25)
ops$tkyte@8i> exec :y := 'Hello'
PL/SQL procedure successfully completed.
ops$tkyte@8i> select * from t where x = :y; no rows selected
ops$tkyte@8i> select * from t where x = rpad(:y,10);
X
Hello
Notice how when doing the search with a varchar2 variable (almost every tool in the world uses this type), we have to rpad() it to get a hit.
If the field is in fact ALWAYS 10 bytes long, using a CHAR will not hurt -- HOWEVER, it will not help either.
The only time I personally use a CHAR type is for CHAR(1). And that is only because its faster to type char(1) then varchar2(1) -- it offers no advantages.
If you just use varchar2 everywhere, no problem
My advice is, has been, will be very loudly stated as:
IGNORE THE EXISTENCE OF CHAR.
period. If you never use char, you never compare char to varchar2, problem solved.
And if you use char and compare a char(n) to a char(m) they will never compare either.
Just say NO TO CHAR.
**************************************************Hi,
>>A CHAR datatype and VARCHAR2 datatype are stored identically (eg: the word 'WORD' stored in a CHAR(4) and a varchar2(4) consume exactly the same amount of space on disk, both have leading byte counts).
Ok, but on the other hands:
SGMS@ORACLE10> create table x (name char(10), name2 varchar2(10));
Table created.
SGMS@ORACLE10> insert into x values ('hello','hello');
1 row created.
SGMS@ORACLE10> commit;
Commit complete.
SGMS@ORACLE10> select vsize(name),vsize(name2) from x;
VSIZE(NAME) VSIZE(NAME2)
10 5
SGMS@ORACLE10> select dump(name),dump(name2) from x;
DUMP(NAME) DUMP(NAME2)
Typ=96 Len=10: 104,101,108,108,111,32,32,32,32,32 Typ=1 Len=5: 104,101,108,108,111Cheers -
Hi there,
I am looking for a convertion, long to varchar2, in a sql statement.
If I run the following query :
select data_default from user_tab_columns
It works fine in sql developper but when I execute it in my PHP code it returns:
Notice: Undefined index: DATA_DEFAULT in /opt/lampp/htdocs/datamodel/index.php on line 64
This issue is due in the case where the columns has null.
So I try with the NVL function:
select nvl(data_default, 'null') from user_tab_columns
ORA-00932: inconsistent datatypes: expected LONG got CHAR
I found on internet some people are using the substr function but it did not working for me.
select substr(data_default, 1, 2000) from user_tab_columns
ORA-00932: inconsistent datatypes: expected NUMBER got LONG
Any one has an idea ?
Regards !See this thread as well you can get an exaple user function
ORA-00932: inconsistent datatypes
G. -
Couldnt able to receive for over due issues
Hi all,
i have a package which will send email if the issue is on a overdue and this is it
-- Create a package to check for overdue issues
-- and send notification email to project lead.
CREATE OR REPLACE package it_check_overdue_issues
AS
PROCEDURE email_overdue;
END;
-- Create package body.
-- Either replace the value of 'c1.person_email' in the
-- code below with valid email or make sure the data in
-- the IT_PEOPLE.PERSON_EMAIL column has valid email addresses.
CREATE OR REPLACE PACKAGE BODY it_check_overdue_issues
AS
PROCEDURE email_overdue
IS
l_msg_body varchar2(32000) := null;
l_count number := 0;
BEGIN
FOR c1 IN
(SELECT pr.project_id,
pr.project_name,
pe.person_name,
pe.person_email
FROM it_projects pr,
it_people pe
WHERE pr.project_id = pe.assigned_project
AND pe.person_role = 'Lead')
LOOP
FOR c2 IN
(SELECT i.target_resolution_date,
i.issue_summary,
p.person_name,
i.status,
i.priority
FROM it_issues i,
it_people p
WHERE i.assigned_to_person_id = p.person_id (+)
AND i.related_project_id = c1.project_id
AND i.target_resolution_date < SYSDATE
AND i.status != 'Closed'
ORDER BY i.target_resolution_date, i.issue_summary)
LOOP
IF l_count = 0 THEN
l_msg_body :=
'As of today, the following issues '||
'are overdue:'||chr(10)||
chr(10)||
' Project: '|| c1.project_name ||chr(10)||
chr(10)||
' Target: '||c2.target_resolution_date ||chr(10)||
' Summary: '||c2.issue_summary ||chr(10)||
' Status: '||c2.status ||chr(10)||
' Priority: '||c2.priority ||chr(10)||
'Assigned to: '||c2.person_name;
ELSE
l_msg_body := l_msg_body ||chr(10)||
chr(10)||
' Target: '||c2.target_resolution_date ||chr(10)||
' Summary: '||c2.issue_summary ||chr(10)||
' Status: '||c2.status ||chr(10)||
' Priority: '||c2.priority ||chr(10)||
'Assigned to: '||c2.person_name;
END IF;
l_count := l_count + 1;
END LOOP;
IF l_msg_body IS NOT NULL THEN
APEX_MAIL.SEND(
p_to => c1.person_email,
p_from => c1.person_email,
p_body => l_msg_body,
p_subj => 'Overdue Issues for Project '||
c1.project_name);
END IF;
l_count := 0;
END LOOP;
END email_overdue;
END it_check_overdue_issues;According to the package, if the issue target resolution date is greater than the sysdate then, the email has to go to the project lead corresponding to that respective project saying that the issue is on overdue.
But im couldnt able to receive any emails, as i checked with an example of raising an overdue issue specifying the target date for that issue as 23-06-2011, so it is less than sysdate so therefore an email has to go to the project lead of that respective project.
But im not receiving any email to me, as i defined myself as a project lead for that overdue project.
What is wrong with the query or with my understanding of the above query.
Thanks
Regards.
MiniHi Robbie,
Thanks for the reply
My package is working perfectly and this is it
-- Create a package to check for overdue issues
-- and send notification email to project lead.
CREATE OR REPLACE package it_check_overdue_issues
AS
PROCEDURE email_overdue;
END;
-- Create package body.
-- Either replace the value of 'c1.person_email' in the
-- code below with valid email or make sure the data in
-- the IT_PEOPLE.PERSON_EMAIL column has valid email addresses.
CREATE OR REPLACE PACKAGE BODY it_check_overdue_issues
AS
PROCEDURE email_overdue
IS
l_msg_body varchar2(32000) := null;
l_count number := 0;
BEGIN
FOR c1 IN
(SELECT pr.project_id,
pr.project_name,
pe.person_name,
pe.person_email
FROM it_projects pr,
it_people pe
WHERE pr.project_id = pe.assigned_project
AND pe.person_role = 'Lead')
LOOP
FOR c2 IN
(SELECT i.target_resolution_date,
i.issue_summary,
p.person_name,
i.status,
i.priority
FROM it_issues i,
it_people p
WHERE i.assigned_to_person_id = p.person_id (+)
AND i.related_project_id = c1.project_id
AND i.target_resolution_date < SYSDATE
AND i.status != 'Closed'
ORDER BY i.target_resolution_date, i.issue_summary)
LOOP
IF l_count = 0 THEN
l_msg_body :=
'As of today, the following issues '||
'are overdue:'||chr(10)||
chr(10)||
' Project: '|| c1.project_name ||chr(10)||
chr(10)||
' Target: '||c2.target_resolution_date ||chr(10)||
' Summary: '||c2.issue_summary ||chr(10)||
' Status: '||c2.status ||chr(10)||
' Priority: '||c2.priority ||chr(10)||
'Assigned to: '||c2.person_name;
ELSE
l_msg_body := l_msg_body ||chr(10)||
chr(10)||
' Target: '||c2.target_resolution_date ||chr(10)||
' Summary: '||c2.issue_summary ||chr(10)||
' Status: '||c2.status ||chr(10)||
' Priority: '||c2.priority ||chr(10)||
'Assigned to: '||c2.person_name;
END IF;
l_count := l_count + 1;
END LOOP;
IF l_msg_body IS NOT NULL THEN
APEX_MAIL.SEND(
p_to => c1.person_email,
p_from => c1.person_email,
p_body => l_msg_body,
p_subj => 'Overdue Issues for Project '||
c1.project_name);
END IF;
l_count := 0;
END LOOP;
END email_overdue;
END it_check_overdue_issues;According to the package the email has to go to the project lead of the corresponding project saying that the 'issue is overdue'
if i compile the package
begin
it_check_overdue_issues.email_overdue;
end;means, it is compiling successfully and also im receiving mails(as to project lead)
But if i schedule to execute the package by defining time interval means, it is not working as this job is compiling successfully but im not receiving any mails from this job and this is it
DECLARE
jobno number;
BEGIN
DBMS_JOB.SUBMIT(
job => jobno,
what => 'BEGIN it_check_overdue_issues.email_overdue; END;',
next_date => SYSDATE,
interval => 'SYSDATE + (2/1440)');
COMMIT;
END;
According to this job it will execute the package for every 2min. so for every 2 min ill be receiving mails. but im not receiving emails for every 2 min as this job is not working. But this job compiled without any error.
Regards,
Mini -
Find out varchar2 string NULL columns and Empty columns
Hi dev's ,
my requiremnt is to find out the string columns Names of whose storing NULL values and EMPTY strings. for that i had written below code. it's getting some error.
SET ECHO OFF;
SET FEEDBACK OFF;
SET SERVEROUTPUT ON;
SET VERIFY OFF;
SET PAGES 0;
SET HEAD OFF;
spool D:\stringnull.csv
DECLARE
v_tab_indent NUMBER(5);
v_col_indent NUMBER(5);
v_val1 VARCHAR2(20);
v_val2 VARCHAR2(20);
v_query1 VARCHAR(500);
v_query2 VARCHAR(500);
BEGIN
--DBMS_OUTPUT.ENABLE(100000);
SELECT MAX(LENGTH(table_name))+1,MAX(LENGTH(column_name)) +1
INTO v_tab_indent,v_col_indent
FROM user_tab_columns
WHERE data_type='VARCHAR2';
FOR i IN
(SELECT table_name,
column_name
FROM user_tab_columns
WHERE data_type IN ('NVARCHAR2', 'CHAR', 'NCHAR', 'VARCHAR2')
ORDER BY table_name,
column_name
LOOP
v_query1:='SELECT NVL('||i.column_name||',0) AS VAL
FROM '||i.table_name||' where '||i.column_name||' IS NULL';
v_query2:='SELECT '||i.column_name||' AS VAL
FROM '||i.table_name||' where '||i.column_name||'=''''';
--dbms_output.put_line(v_query1);
-- dbms_output.put_line(v_query2);
EXECUTE immediate v_query1 INTO v_val1;
EXECUTE immediate v_query2 INTO v_val2;
dbms_output.put_line (rpad(i.table_name,v_tab_indent,' ')||','||rpad(i.column_name,v_col_indent,' ')||' ,'||v_val1||','||v_val2);
END LOOP;
END;
Spool OFF
Set echo on
Set feedback onERROR:
Error report:
ORA-01403: no data found
ORA-06512: at line 31
01403. 00000 - "no data found"
*Cause:
*Action:
set feedback onpls help me on this issue..
Thanks,Example:
SQL> DECLARE
2 v_val VARCHAR2(20);
3 v_query1 VARCHAR(32767);
4 BEGIN
5 FOR i IN (SELECT table_name, column_name FROM user_tab_columns
6 WHERE data_type IN ('NVARCHAR2', 'CHAR', 'NCHAR', 'VARCHAR2')
7 ORDER BY table_name, column_name
8 )
9 LOOP
10 v_query1 := 'SELECT count(*) FROM '||i.table_name||' where '||i.column_name||' IS NULL';
11 EXECUTE immediate v_query1 INTO v_val;
12 dbms_output.put_line(rpad(i.table_name,30,' ')||' : '||rpad(i.column_name,30,' ')||' : '||v_val);
13 END LOOP;
14 END;
15 /
CHILD_TAB : DESCRIPTION : 0
DEPT : DNAME : 0
DEPT : LOC : 0
EMP : ENAME : 0
EMP : JOB : 0
MYEMP_OLD : ENAME : 0
MYEMP_OLD : JOB : 0
MYNULLS : ENAME : 0
MYNULLS : JOB : 4
PARENT_TAB : DESCRIPTION : 0
T : CHAR_VALUE : 0
TABLE1 : COL1_DESC : 0
PL/SQL procedure successfully completed.
Maybe you are looking for
-
Letter of Credit management in SAP Business one
Hi All, One of our customer wants to manage the "Letter of Credit" used in exporting their product to different countries. They need to record it, discount it from bank, record bank charges and close it when their customer repays the amount. Also nee
-
How to call ALV Report and SMARTFORMS through Pushbutton
hi, i have created a report.My task is to create two buttons: 1)ALV Report. 2)SMARTFROMS. Through these button i have to call ALV Report and SMARTFORMS. i have created both button and when i execute the program, it shows me the button but not working
-
Need Help Converting movie files!!!!
I created a 66mb movie in IMovie 08 that I need to save and convert to be less than 50mb and be view by Windows Media Player. Any help will be greatly appreciated. Amy
-
I've read some SAP doco talking about a CCMS Central Monitoring System (CEN). Does that mean having CCMS on it's own Server - and CCMS is monitoring all DEV, QAS and PRD systems. What is the usual way if you have R/3, BW, XI. Which box should have
-
JNDI Support in Directory Server 5.1 and 5.2
Does anyone know where I can find documentation on whether Directory Server supports - JNDI -(java naming directory interface), and whether this is an industry standard that is outlined in an RFC somewhere? Thanks