Using substr / instr to parse a filepath help
I'm having trouble parsing a string per say using sql. I have a column full of file paths. The file paths are similar to:
C:\Users\Guest\Pictures\example.jp
I want to be ablt to grab just the file name of the image. I've been working on several variations of a query using the substr function and the instr function. I've come up with the query below. FILEPATH is the name of the column. So far it gives me the file name, but has the '\' in front of it. Can anyone help me get rid of this. Thanks in advance.
Select substr(FILEPATH, (instr(FILEPATH,'\',-1,1)))
from Table_Name
where ID = '101'
Hi,
Here's one way:
SELECT SUBSTR ( filepath
, INSTR ( filepath
, -1
, 1
) + 1 -- Note + 1 at end
) AS file_name_only
FROM Table_Name
WHERE id = '101'
SUBSTR (str, p) returns the last part of string str, starting at position p. You were passing the position of the last '\' as p; that's why the '\' was included. If you add 1 to p, like this:
SUBSTR (str, p+1) then you'll be passing the position of the 1st character after the last '\'.
Similar Messages
-
How to use Substr & Instr to get data from a file
hi i have a Scenario
i am getting a file like this
1,20,ram,sales
i am getting a file like this data as a column
i want to split this data in 4 different column like
1 20 ram SalesHi,
this query will help you.
select
SUBSTR(C1,0,INSTR(C1,',')-1),
SUBSTR(C1,INSTR(C1,',')+1,INSTR(C1,',',1,2)-INSTR(C1,',',1,1)-1),
SUBSTR(C1,INSTR(C1,',',1,2)+1,INSTR(C1,',',1,3)-INSTR(C1,',',1,2)-1),
SUBSTR(C1,INSTR(C1,',',1,3)+1,INSTR(C1,',',1,4)-INSTR(C1,',',1,3)-1),
SUBSTR(C1,INSTR(C1,',',1,3)+1)
from (
select '1,20,ram,sales' C1 from dual
remember that a comma isn't really safe as field separator
Message was edited by: DecaXD -
How to fetch data using Substring & Instring
Hi ,
I have data like
a_76488b_2780c
a_76488b_2780c_
a_76488b_c2780
a_76488b_c2780
a_31487b_5542
a_76488b_2780
i want to fetch data like last 4 numeric digit only
2780
2780
2780
2780
5542
2780I don't know what you have against rexexp_replace, but this works if you want all the digits after the second underscore:
WITH t AS
(SELECT 'a_76488b_2780c' str FROM DUAL
UNION ALL
SELECT 'a_76488b_2780c_' FROM DUAL
UNION ALL
SELECT 'a_76488b_c2780' FROM DUAL
UNION ALL
SELECT 'a_76488b_c2780' FROM DUAL
UNION ALL
SELECT 'a_31487b_5542' FROM DUAL
UNION ALL
SELECT 'a_76488b_2780' FROM DUAL
SELECT replace(after_second_und
,replace(translate(after_second_und
,'0123456789'
,NULL
,NULL
) your_number
FROM (SELECT SUBSTR(str,instr(str,'_',1,2)+1) after_second_und
FROM t
YOUR_NUMBER
2780
2780
2780
2780
5542
2780 -
Substr / Instr or Subquery
Hi All,
I have a requirement for which I am looking for solution, kindly do the needful.
CREATE TABLE CO_VENDOR_COMMODITY
(VENDOR_CODE VARCHAR2(240),
COMMODITY_CODE NUMBER);
INSERT INTO CO_VENDOR_COMMODITY VALUES ('25',1);
INSERT INTO CO_VENDOR_COMMODITY VALUES ('25',2);
INSERT INTO CO_VENDOR_COMMODITY VALUES ('25',3);
INSERT INTO CO_VENDOR_COMMODITY VALUES ('25',4);
INSERT INTO CO_VENDOR_COMMODITY VALUES ('20',1);
INSERT INTO CO_VENDOR_COMMODITY VALUES ('20',2);
INSERT INTO CO_VENDOR_COMMODITY VALUES ('20',3);
INSERT INTO CO_VENDOR_COMMODITY VALUES ('20',4);
INSERT INTO CO_VENDOR_COMMODITY VALUES ('20',5);
INSERT INTO CO_VENDOR_COMMODITY VALUES ('30',21);
INSERT INTO CO_VENDOR_COMMODITY VALUES ('30',22);
INSERT INTO CO_VENDOR_COMMODITY VALUES ('30',23);
INSERT INTO CO_VENDOR_COMMODITY VALUES ('30',24);
INSERT INTO CO_VENDOR_COMMODITY VALUES ('30',25);
INSERT INTO CO_VENDOR_COMMODITY VALUES ('40',15);
INSERT INTO CO_VENDOR_COMMODITY VALUES ('40',16);
INSERT INTO CO_VENDOR_COMMODITY VALUES ('40',17);
INSERT INTO CO_VENDOR_COMMODITY VALUES ('40',18);
INSERT INTO CO_VENDOR_COMMODITY VALUES ('35',15);
INSERT INTO CO_VENDOR_COMMODITY VALUES ('35',16);
INSERT INTO CO_VENDOR_COMMODITY VALUES ('35',17);
CREATE OR REPLACE VIEW OV_VENDOR AS
select
VENDOR_CODE,
rtrim (xmlagg (xmlelement (e,COMMODITY_CODE || ',')).extract ('//text()'), ',') commcode
from
CO_VENDOR_COMMODITY
group by
VENDOR_CODE;
Output should display as below
VENDOR_CODE COL1 COL2 COL3 COL4 COL5
20 1 2 3 4 5
25 1 2 3 4
30 21 22 23 24 25
35 15 16 17
40 15 16 17 18
as of now I have built the below query further I am not able to proceed.
SELECT VENDOR_CODE,
COMMCODE,
SUBSTR(COMMCODE,1,(INSTR(COMMCODE,',',1,1) -1)) COL1,
SUBSTR(COMMCODE,(INSTR(COMMCODE,',',1,1)+1),(LENGTH(SUBSTR(COMMCODE,(INSTR(COMMCODE,',',1,1)+1)))-LENGTH(SUBSTR(COMMCODE,(INSTR(COMMCODE,',',1,2)))))) COL2,
SUBSTR(COMMCODE,(INSTR(COMMCODE,',',1,2)+1),(LENGTH(SUBSTR(COMMCODE,(INSTR(COMMCODE,',',1,2)+1)))-LENGTH(SUBSTR(COMMCODE,(INSTR(COMMCODE,',',1,3)))))) COL3,
SUBSTR(COMMCODE,(INSTR(COMMCODE,',',1,3)+1),(LENGTH(SUBSTR(COMMCODE,(INSTR(COMMCODE,',',1,3)+1)))-LENGTH(SUBSTR(COMMCODE,(INSTR(COMMCODE,',',1,4)))))) COL4_1,
SUBSTR(COMMCODE,(INSTR(COMMCODE,',',1,4)+1)) COL5,
'SUBSTR(COMMCODE,('||INSTR(COMMCODE,',',1,3)||'+1),('||LENGTH(SUBSTR(COMMCODE,(INSTR(COMMCODE,',',1,3)+1)))||' - '||LENGTH(SUBSTR(COMMCODE,(INSTR(COMMCODE,',',1,4))))||'))' COL4
FROM OV_VENDOR
To acheive the above output whether I need use substr/instr or should I go for subquery? which one is best? It is possible to acheive the above output by using subquery?
Thanks in advance.
-SatyamOh wait, I now see you want the commodity codes in separate columns.
If you have a fixed maximum of possible commodity codes, you can use a subquery:
SQL> select vendor_code
2 , max(case when rn=1 then commodity_code else null end ) col1
3 , max(case when rn=2 then commodity_code else null end ) col2
4 , max(case when rn=3 then commodity_code else null end ) col3
5 , max(case when rn=4 then commodity_code else null end ) col4
6 , max(case when rn=5 then commodity_code else null end ) col5
7 from ( select vendor_code
8 , commodity_code
9 , row_number() over (partition by vendor_code order by commodity_code) rn
10 from co_vendor_commodity
11 )
12 group by vendor_code;
VENDO COL1 COL2 COL3 COL4 COL5
20 1 2 3 4 5
25 1 2 3 4
30 21 22 23 24 25
35 15 16 17
40 15 16 17 18 -
How to Split the string using Substr and instr using loop condition
Hi every body,
I have below requirement.
I need to split the string and append with single quotes('') followed by , (comma) and reassign entire values into another variable. so that i can use it where clause of update statement
for example I am reciveing value as follows
ALN varchar2(2000):=(12ERE-3MT-4Y,4IT-5O-SD,OP-K5-456,P04-SFS9-098,90P-SSF-334,3434-KJ4-O28,AS3-SFS0-J33,989-3KL-3434);
Note: In the above variable i see 8 transactions, where as in real scenario i donot how many transaction i may recive.
after modification i need above transactions should in below format
ALTR Varchar2(2000):=('12ERE-3MT-4Y','4IT-5O-SD','OP-K5-456','P04-SFS9-098','90P-SSF-334','3434-KJ4-O28','AS3-SFS0-J33','989-3KL-3434');
kindly help how to use substr and instr in normal loop or for loop or while loop while modifying the above transactions.
Please help me to sort out this issue.
Many Thanks.
Edited by: user627525 on Dec 15, 2011 11:49 AMTry this - may not be the best way but...:
create or replace type myTableType as table of varchar2(255)
declare
v_array mytabletype;
v_new_str varchar2(4000);
function str2tbl
(p_str in varchar2,
p_delim in varchar2 default '.')
return myTableType
as
l_str long default p_str || p_delim;
l_n number;
l_data myTableType := myTabletype();
begin
loop
l_n := instr( l_str, p_delim );
exit when (nvl(l_n,0) = 0);
l_data.extend;
l_data( l_data.count ) := ltrim(rtrim(substr(l_str,1,l_n-1)));
l_str := substr( l_str, l_n+length(p_delim) );
end loop;
return l_data;
end;
begin
v_array := str2tbl ('12ERE-3MT-4Y,4IT-5O-SD,OP-K5-456,P04-SFS9-098,90P-SSF-334,3434-KJ4-O28,AS3-SFS0-J33,989-3KL-3434', ',');
FOR i IN 1 .. v_array.COUNT LOOP
v_new_str := v_new_str || ''''||v_array(i)||'''' || ',';
END LOOP;
dbms_output.put_line(RTRIM(v_new_str, ','));
end;
OUTPUT:
=======
'12ERE-3MT-4Y','4IT-5O-SD','OP-K5-456','P04-SFS9-098','90P-SSF-334','3434-KJ4-O28','AS3-SFS0-J33','989-3KL-3434'HTH
Edited by: user130038 on Dec 15, 2011 12:11 PM -
Hi,
I have a table tablea where a column stores values like ABC LTD,BCD LTD,CEF LTD,DEFEF LTD.
I want the output as
ABC,BCD,CEF,DEF
i have used substr but could not frame the result as the last value stores DEFEF so culd not do substr(1,3) from the table
Any help will be needful for me
Edited by: user13443042 on Jan 26, 2011 2:31 AMYou mean like this?
SQL> ed
Wrote file afiedt.buf
1 select trim('.' from replace('ABC LTD,BCD LTD,CEF LTD,DEF LTD.',' LTD'))
2* from dual
SQL> /
TRIM('.'FROMREP
ABC,BCD,CEF,DEF
SQL>However, it looks like your data structure is wrong. You shouldn't store multiple values in a single string in a colulmn. These should be multiple records or multiple columns as appropriate. -
Using substr function loses index. Query tune help
Hi
when i use substr function in the join condition it loses index and the query is slow. How to fix this problem or tune this query. These are the lines in the query.
and substr(a.invoice_num,1,9) = l.invoice_num
and substr(c.invoice_num,1,9) = mgr_apprv_lst.user_key
and substr(c.invoice_num,1,9) = pbl_apprv_lst.user_key
select
pap.full_name employe_name,
k.SEGMENT1 ||'.' ||k.segment2 Cost_Center,
a.invoice_num Invoice_Number,
b.item_description Line_Item,
b.amount Amount,
cc.trx_id Corporate_Card_Transaction_Id,
cc.transaction_date Date_Charge_Incurred,
cc.posted_date Date_Charge_Posted_To_USBank,
cc.creation_date Date_Posted_To_IExpense,
a.creation_date Expense_Report_Creation_Date,
l.report_submitted_date Expense_Report_Submitted_Date,
mgr_apprv_lst.activity_begin_date Managers_Approval_Begin_Date,
mgr_apprv_lst.activity_end_date Managers_Approval_End_Date,
pbl_apprv_lst.activity_begin_date AP_Approval_Begin_Date,
pbl_apprv_lst.activity_end_date AP_Approval_End_Date,
e.check_date Payment_Date_To_USBank,
e.check_number Payment_Number,
mgr_apprv_lst.activity_result_display_name Managers_Process_Result,
pbl_apprv_lst.activity_result_display_name AP_Process_Result
from
ap_checks_all e,
ap_invoice_payments_all d,
ap_invoices_all c,
ap_expense_report_headers_all a,
ap_credit_card_trxns_all cc,
per_all_people_f pap,
ap_expense_report_headers_all l,
ap_expense_report_lines_all b,
gl_code_combinations k,
(select ias1.user_key,
ias1.activity_result_display_name,
ias1.activity_begin_date,
ias1.activity_end_date
from wf_item_activity_statuses_v ias1,
(select c1.invoice_num
from ap_checks_all e1,
ap_invoice_payments_all d1,
ap_invoices_all c1
where trunc(e1.check_date) between nvl(:From_Date, trunc(e1.check_date))
and nvl(:To_Date, trunc(e1.check_date))
and e1.org_id = 141
and e1.void_date IS null
and d1.check_id = e1.check_id
and c1.invoice_id = d1.invoice_id) inv_lst1
where ias1.item_type = 'APEXP'
and ias1.user_key = inv_lst1.invoice_num
and ias1.activity_name = 'AP_MANAGER_APPROVAL_PROCESS') mgr_apprv_lst,
(select ias2.user_key,
ias2.activity_result_display_name,
ias2.activity_begin_date,
ias2.activity_end_date
from wf_item_activity_statuses_v ias2,
(select c2.invoice_num
from ap_checks_all e2,
ap_invoice_payments_all d2,
ap_invoices_all c2
where trunc(e2.check_date) between nvl(:From_Date, trunc(e2.check_date))
and nvl(:To_Date, trunc(e2.check_date))
and e2.org_id = 141
and e2.void_date IS null
and d2.check_id = e2.check_id
and c2.invoice_id = d2.invoice_id) inv_lst2
where ias2.item_type = 'APEXP'
and ias2.user_key = inv_lst2.invoice_num
and ias2.activity_name = 'AP_PAYABLES_APPROVAL_PROCESS') pbl_apprv_lst
where
trunc(e.check_date) between nvl(:From_Date, trunc(e.check_date))
and nvl(:To_Date, trunc(e.check_date))
and e.org_id = 141
and e.void_date IS null
and d.check_id = e.check_id
and c.invoice_id = d.invoice_id
and a.invoice_num = c.invoice_num
and a.source = 'CREDIT CARD'
and a.employee_id = nvl(:Emp_id,a.employee_id)
and a.report_header_id = b.report_header_id
and cc.trx_id = b.credit_card_trx_id
and pap.person_id = a.employee_id
and pap.effective_start_date <= trunc(sysdate)
and pap.effective_end_date >= trunc(sysdate)
and k.code_combination_id = b.code_combination_id
and k.segment2 between nvl(:From_Cost_Center,k.segment2)
and nvl(:To_Cost_Center,k.segment2)
and substr(a.invoice_num,1,9) = l.invoice_num
and substr(c.invoice_num,1,9) = mgr_apprv_lst.user_key
and substr(c.invoice_num,1,9) = pbl_apprv_lst.user_keyHi
If I understood correctly your logic, and if the columns involved are of type varchar2, you can use the like operator:
and a.invoice_num like l.invoice_num || '%'
and c.invoice_num like mgr_apprv_lst.user_key || '%'
and c.invoice_num like pbl_apprv_lst.user_key || '%'In this case, Oracle will be able to use the indexes. If they are numeric, you need to do something like:
and a.invoice_num between l.invoice_num * 1000000
and l.invoice_num * 1000000 + 999999I hope this makes sense...
Luis -
Hi All,
i am a comma seperated values into a variable. below are the values.
"1234567,3,124567,3,14"
the length of the values can vary. eg the output can also be
"123,3,124567,443,1224"
I need to get each value and store it a separate variable. is it possible using substr..?
Please help me out...Hi,
Here's how you can split a delimited list into parts in Oracle 9:
WITH got_part_cnt AS
SELECT pk
, csv
, 1 + LENGTH (csv)
- LENGTH (REPLACE (csv, ',')) AS part_cnt
FROM table_x
, cntr AS
SELECT LEVEL AS n
FROM ( SELECT MAX (part_cnt) AS max_part_cnt
FROM got_part_cnt
CONNECT BY LEVEL <= max_part_cnt
, got_pos AS
SELECT p.pk
, p.csv
, c.n
, INSTR ( ',' || p.csv
, 1
, c.n
) AS start_pos
, INSTR ( p.csv || ','
, 1
, c.n
) AS end_pos
FROM got_part_cnt p
JOIN cntr c ON c.n <= p.part_cnt
SELECT pk
, csv
, n
, SUBSTR ( csv
, start_pos
, end_pos - start_pos
) AS item
FROM got_pos
ORDER BY pk
, n
;Pk is the primary key of table_x. If you don't need it, you can omit it.
Of course, this will work in versions later than 9, but you wouldn't want to if you could use REGEXP_SUBSTR. -
Dynamic PL/SQL & substr, instr function
I am having trouble with incorporating the SUBSTR and INSTR functions into my dynamic PL/SQL procedure using Oracle 8i.
I have data that is packed into one column seperated by a delimiter (':')
I need to seperate the data to use indicidual pieces.
If I run my query in general -
select substr(secondcol, 1, instr(secondcol, ':',1,1)-1) ONE,
substr(secondcol,instr(secondcol, ':',1,1)+1,instr(secondcol, ':',1,1)-1) TWO,
substr(secondcol,instr(secondcol, ':',1,2)+1,instr(secondcol, ':',1,1)-1) THREE,
substr(secondcol,instr(secondcol, ':',1,3)+1,instr(secondcol, ':',1,1)-1) FOUR
from temp_table where firstcol=100
This works and gives me the right result.
e.g
DATA :
Firstcol SECONDCOL
100 1:2:3:4
Result:
ONE TWO THREE FOUR
1 2 3 4
However to make this generic if I use it in a function passing it a parameter which has ':' delimited data it does not work and gives me errors. All I want is to get the output as a string that looks like my query above so I can use it in my proc.
create or replace function MYJUNK(TFieldNew IN CHAR)
RETURN CHAR IS
UpdateString Varchar2(100);
BEGIN
UpdateString := 'First=substr('||TFieldNew||', 1, instr('||TFieldNew||', '':'',1,1)-1) ONE, ';
UpdateString := UpdateString || ' Second=substr('||TFieldNew||', instr('||TFieldNew||', '':'',1,2)+1, instr('||TFieldNew||', '':'',1,1)-1) TWO, ';
UpdateString := UpdateString || ' third=substr('||TFieldNew||', instr('||TFieldNew||', '':'',1,3)+1, instr('||TFieldNew||', '':'',1,1)-1) THREE from temp_table';
return UpdateString;
END;
The function compiles but gives me run time errors
This is what I get -
SQL> select myjunk('''1:2:3:4''') from dual;
select myjunk('''1:2:3:4''') from dual
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error
ORA-06512: at "SGHDTA.MYJUNK", line 8
ORA-06512: at line 1You are getting an error because updatestring is longer than the 100 characters you defined it as. Try using VARCHAR2(4000). Also, if you are trying to generate the sql statement, you need to get rid of first=, second= and third= when you build the string.
This is what your function returns. I put in line breaks for clarity:
First=substr('1:2:3:4', 1, instr('1:2:3:4', ':',1,1)-1) ONE,
Second=substr('1:2:3:4', instr('1:2:3:4', ':',1,2)+1, instr('1:2:3:4',':',1,1)-1) TWO,
third=substr('1:2:3:4', instr('1:2:3:4', ':',1,3)+1,instr('1:2:3:4', ':',1,1)-1) THREE
from temp_tableIf you are trying to actually parse the column, then you need something more like:
create or replace procedure MYJUNK(TFieldNew IN VARCHAR2,out1 OUT VARCHAR2,
out2 OUT VARCHAR2, out3 OUT VARCHAR2) is
BEGIN
out1 := SUBSTR(TFieldNew,1, INSTR(TFieldNew,':',1,1)-1);
out2 := SUBSTR(TFieldNew, INSTR(TFieldNew,':',1,2)+1, INSTR(TFieldNew,':',1,1)-1);
out3 := SUBSTR(, INSTR(TFieldNew,':',1,3)+1, INSTR(TFieldNew,':',1,1)-1);
END; -
Substring instr issue in obiee
Hi,
I want to use the INSTR function in OBIEE
POSITION function found in the forum
INSTR function takes four values:
INSTR (string1, string2, number, number)
Eg IP address
111.222.333.444
The desired result
SUBSTR (IP_ADD, 1, INSTR (IP_ADD, '.', 1,3) -1)
111.222.333
POSITION function, how should I use?
Thanks,
Mino1st example '0.0.0.0' will def be a problem here. Unfortunately, I don't think any other OBIEE string function could support this.
I was assuming for min 2 numbers like 00.00.00.00. Do you have any case like the first one in your table ?
=========
As I said, you can't use POSITION function here..Just do help for String Function in RPD)
Position
Returns the numerical position of the character_expression1 in a character expression. If the character_expression1 is not found, the function returns 0.
Syntax:
POSITION(character_expression1 IN character_expression2)
where:
character_expression1
Any expression that evaluates to a character string. Used to search in the second string.
character_expression2
Any expression that evaluates to a character string.
So, these are the 2 expression, In your case its '.' & IP_ADDR.
=========
Hope its helpful -
How to use substr in external table defnition.
Hi All,
Im using oracle 11g. I have an external table which is reading data from a file. For one of the column, i need to get only the first 250 characters. My external table defnition looks like this
create table tbl_substr
( col1 varchar2(20),
col2 varchar2(250)
organization external
( type oracle_loader
default directory XXXX
access parameters (
records delimited by newline
FIELDS TERMINATED BY '|'
missing field values are null
( col1 ,
col2 "substr(:col2,1,250)"
) ) location ('file.txt') )
reject limit unlimited
But this defnition gives an error when i do select * from tbl_substr
I want to use substr in external table defnition its self and not in SELECT. Also i dont want to crete a view to solve this. If anyone has done this please help.You need to play with COLUMN_TRANSFORMS
http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/et_params.htm#sthref1792
BTW, i too got it from Google. I was not aware about this :)
Amardeep Sidhu -
How to use substring in ITS(HTML file)
Hai,
I am modifying d_searchhelp.html file in agate. I want a use a substring function this file. So I used the below code.
newclassname=~searchhelpcontrolname;
oldclassname=newclassname.substring(0,8);
^ ^ ^
This is the error i got when i use this HTML file in searchhelp.
@ ...\templates\system\dm\msiexplorer\d_searchhelp.html (263,42): error : syntax error : '('
@ ...\templates\system\dm\msiexplorer\d_searchhelp.html (263,44): error : syntax error : ','
@ ...\templates\system\dm\msiexplorer\d_searchhelp.html (263,46): error : syntax error : ')'
Please let me know how to use substring.
Thanks & Regards,
H.K.Hayath BashaHello H.K.Hayath Basha,
please see the HTML Business documentation on <http://help.sap.com/saphelp_nw04/helpdata/en/5f/1fb5174aee11d189740000e8322d00/frameset.htm>:
string strSub (in string string, in int position, in int length)
With regards,
TJ -
Namespaces / apache.crimson.parser / BASDA XML / HELP!!
This is probably an easy question but I can't find anyone to help me.
I am using the apache.crimson.parser to parse and validate an Xml doc against the BASDA eBIS-XML purchase order schema but i can't get the Namespaces right.
I have this at present for the Xml doc;
<Order xmlns ="urn:schemas-microsoft-com:xml-data"
xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:schemas-microsoft-com:xml-data
http://www.cs.aston.ac.uk/hillsm/project/eBIS-XML_Order_v3.01.xml">
....and this for the schema;
<Schema name="eBIS-XML_Order_v3.01.xml"
xmlns="urn:schemas-microsoft-com:xml-data"
xmlns:dt="urn:schemas-microsoft-com:datatypes">
Does anyone have any ideas??Steven,
let me first note that I'm not familiar with the specific Schema you mention here (apparently from M$), and it would have been helpful to see at least part of it in your posting, because it seems abnormal that Microslob uses the conventional xsd namespace for schema declarations (although it wouldn't surprise me).
Anyways, let's do a first version without the xsd name space.
The declarations in your xml file are correct.
In the schema file, the first error is, that schema is misspelled as Schema. Secondly, schema does not allow a name attribute (get rid of it). There is also no reference to the namespace "http://www.w3.org/2001/SMLSchema". So, the default namespace has to be changed to that. The targetNamespace attribute specifies that this schema applies to the specified name space. Putting it all together:
<?xml version="1.0"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:schemas-microsoft-com:xml-data"
xmlns:dt="urn:schemas-microsoft-com:datatypes">
<!-- let's have fun and declare an Order element that would work with just one
order element defined in the xml file. -->
<element name="Order" type="string"/>
</schema>So this would validate OK with this xml file (provided that ..../eBIS-XML_Order_v3.01.xml is the above schema file):
<?xml version="1.0"?>
<Order xmlns ="urn:schemas-microsoft-com:xml-data"
xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:schemas-microsoft-com:xml-data
http://www.cs.aston.ac.uk/hillsm/project/eBIS-XML_Order_v3.01.xml">
</Order> So, in this example, the default namespace in the schema is set to "http://www.w3.org/2001/XMLSchema" and the targetNamespace attribute points to the xml file's default name space.
However, the standard way of doing things differs. You certainly should not (mis-)set the schema's default name space to "http://www.w3.org/2001/XMLSchema".
I do not know in what way Microsoft limits you, but I strongly recommend something along these lines in order to not have regrets, headache and coffein and nicotine addiction lateron:
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="urn:schemas-microsoft-com:xml-data"
xmlns:dt="urn:schemas-microsoft-com:datatypes"
targetNamespace="urn:schemas-microsoft-com:xml-data">
<xsd:element name="Order" type="xsd:string"/>
</xsd:schema>Also, in order to avoid confusion, Schema files should have the extension xsd - a minor sidepoint.
Hope that helps,
Leo. -
#UNAVAILABLE error in measures when using substr() in BO XI 3.1 SP3
Hi All,
I'm using BO XI 3.1 SP3 with Essabse 11 for OLAP Connection.
I got #UNAVAILABLE value for database delegated measures when using substr() on the dimension.
The aggregation function have to be database delegated because the measure need to be calculated again in aggregation level, such as MOM (month on month) and YOY (year on year) etc.
Can someone help to solve this problem?
Regards
SofianHi, Sofian!
We also are trying to work in XI 3.1 SP3 with Essbase as data source.
As I understand there is no support for any essbase mdx/xmla calculations or functions in universe.
In document called "OLAP universes - best practice" are given some examples for SAP BW and MSAS only.
With Essbase OLAP source I can't even make simple measure like Measure1+Measure2, @Select doesn't work too.
All I've reached in this field - creating filters, prompts and LOV-dimensions with restricted number of levels in hierarchy (by filter in Where part.
But the main problem for us is - YTD calculations.
In our Essbase it is dynamic calculated objects, so I need to use Y-T-D function to use it.
Also we want to use Level-based, not Gen-based, ordering dimensions, but I didn't find any information about it
Did you find some examples, documents or reviews in this area?
Now, it seems like there is no any big project BOE+Essbase in the world... -
To find out " dot" using substr in oracle
Hi ,
I would like to find "Dot" between Schemaname and table name using substring in Oracle . I am using oracle 9i.I can't use Regexp in Oracle 9i
Schemaname .tablename
Table name can be any no of characters
Schema name also can be any no of characters
Regards,
UserAre you looking for this?
satyaki>
satyaki>select * from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
Elapsed: 00:00:00.01
satyaki>
satyaki>
satyaki>
satyaki>declare
2 str varchar2(30);
3 ctr varchar2(30);
4 begin
5 str := 'SCOTT.EMP';
6
7 ctr := 'SCOTT';
8
9 if ctr = substr(str,1,instr(str,'.')) then
10 dbms_output.put_line('User Matches....');
11 else
12 dbms_output.put_line('User Does Not Matches....');
13 end if;
14 end;
15 /
User Does Not Matches....
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.01
satyaki>
satyaki>declare
2 str varchar2(30);
3 ctr varchar2(30);
4 begin
5 str := 'SCOTT.EMP';
6
7 ctr := 'SCOTT';
8
9 if ctr = substr(str,1,instr(str,'.')-1) then
10 dbms_output.put_line('User Matches....');
11 else
12 dbms_output.put_line('User Does Not Matches....');
13 end if;
14 end;
15 /
User Matches....
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.00
satyaki>Regards.
Satyaki De.
Maybe you are looking for
-
Mac pro System Slows down without external Battery
All my app ,videos run very slow(Videos are most vulnerable) without external battery .However my battery charge shows 100 % ,mac pro 13inch Early 2011 can you please advise what could be the problem
-
MIgrating Oracle Applications 11i from solaris 9 to Solaris 10
Hi All, I want to migrate the two node oracle applications (11.5.10.2) from solaris 9 to soalris 10. I want to know any technical doucument or metalink tech note regarding this migration.current OS OS = Sun OS 5.9, 64 bit Target OS OS = Sun OS 5.10,
-
Hi! Here's our scenario: we wanted our PO to be non-editable when it comes to price when it has already a goods receipt. But right now, the system allows it and no available system messages can suffice the requirement. Is there an available user exit
-
Records getting multiplied by a factor of 3 when joining with other table
When i query a table association_1 records for a particular network element i get 7 records but join it with rtts_association table to get the rtts_no i m getting 21 records..... the problems is ... 7 records are getting multiplied by a factor of 3 r
-
Zusammenschnitt Filmmaterial mehrerer Kameras in Premiere Pro
Hallo liebe Community, ich bin noch relativ neu bei Adobe und hätte eine Frage zu der ich noch keine Antwort gefunden habe. Und zwar, ich selbst bin Medienwart und Webadmin von meinem Theaterverein. Zur Aufnahme unserer letzten Vorführung habe ich 2x