Generate table/view automatically from xsd
Hello all,
following requirement: I receive xml files and appropriate xsd. I don't want to parse the xml by hand (e.g. I know of the possibility to create views from xml with extract - extracting elements manually). Is it any possibility to achieve this:
input: xml file with xsd -> automatical processing: something what I don't know -> output: view. How I already mentioned I just know of the possibility to extract the values manually. After a brief search I found DBMS_XMLSCHEMA.registerSchema but I don't know if it helps me. Registering xsd makes the DB know how the xml look like.
Do you have any ideas?
Thank you in advance for your answers. I appreciate any hint.
Kind regards,
Anton
>
But you don't have to program element 1 in column 1, element 2 in column 2 etc. It handles it automatically. You just say insert into <your table 1> ds.Tables["table1 from xml"].
>
it's look as
insert into <table_name>
select *
from <some table or view>but
what if table will be altered, say add column
or
what if
select *
from <some table or view>will be return more columns than in <table_name>
you get errors
as for
>
ds.Tables["table1 from xml"]
>
not sure what is work correctly on complex schema with complex type
if you have simple xml
you can try to parse it dynamically:
- parse xml to find list of tags with path
- create script which will be generate script for xml like
select <columns>
from <table>
, xmltable (
<columns>
)then create view on the above script
if your xml structure will be often changing then you must be recreate your script and recreate view
for xml sample from xsd
http://www.codeproject.com/Articles/400016/Generate-Sample-XML-from-XSD
Similar Messages
-
How to generate the BPEL interface from XSD?
I am new to the BPEL. How to generate the BPEL interface from XSD because I need the inputed payload to have a complex type instead the simple string?
Thank youI made the following change to the xsd file, however when the input type change to emailDataType, it is underline by red color. and the bpm process, activity guide, organization become the unknown project object.
<?xml version="1.0" encoding="UTF-8"?>
<schema attributeFormDefault="unqualified"
elementFormDefault="qualified"
targetNamespace="http://xmlns.oracle.com/SampleBPM/SampleEmailNotification/SendEmail"
xmlns="http://www.w3.org/2001/XMLSchema">
<element name="process">
<complexType>
<sequence>
<element name="input" type="emailDataType"/>
</sequence>
</complexType>
</element>
<element name="processResponse">
<complexType>
<sequence>
<element name="result" type="string"/>
</sequence>
</complexType>
</element>
<complexType name="emailDataType" >
<sequence>
<element name="toEmailAddress" type="string" />
<element name="ccEmailAddress" type="string" />
<element name="emailSubject" type="string" />
<element name="emailContent" type="string" />
</sequence>
</complexType>
</schema>
The XSD file is viewed by the design mode is fine on JDeveloper. Please help! -
I lost some tables, view, triggers from my schema
Hi all,
I have two DBA users in Oracle 10g Database, one user already have tables,views, procedures etc. i took a dump of old_schema and restore to new_schema. after some time i lost all views ,triggers and some table from old_schema, i lost this much objects from my old_schema, anybody have face this problem before, how can i recover it
Edited by: 911604 on Feb 1, 2012 10:53 AM911604 wrote:
Hi all,
I have two DBA users in Oracle 10g Database, one user already have tables,views, procedures etc. i took a back up of first user restore to second user after some time i lost all views ,triggers and some table , why i lost this much objects from my user, anybody have face this problem before, how can i recover itWell bad karma, bad luck, some bad omen , anything can cause it isn't it!
Jokes apart, there is nothing that you have told to us which can enable us to suggest you something fruitful. Objects don't get dropped automatically so someone must have dropped them by himself. So ask around, check some auditing logs if you have to know who fired the commands. And if you don't have auditing records, mine the redo log files to find the same.
Aman.... -
How does one copy tables, views, etc. from one database to another?
I do not have a strong DBA background but have been placed in charge of updating and migrating a number of tables and views across multiple databases.
For the future I need a better workflow than exporting and importing tables to/from .csv files and copy and pasting the SQL from each individual view.
Can somebody point me in the right direction? I'm happy to do some reading but have no idea where to look.The Export utility provides a simple way for you to transfer data objects between Oracle databases, even if they reside on platforms with different hardware and software configurations.
When you run Export against an Oracle database, objects (such as tables) are extracted, followed by their related objects (such as indexes, comments, and grants), if any. The extracted data is written to an Export file.
To use Export, you must run the script catexp.sql or catalog.sql (which runs catexp.sql) after the database has been created,Ensure there is sufficient disk or tape storage to write the export file,Verify that you have the required access privileges.
Interactive Export Prompts
If you prefer to let Export prompt you for the value of each parameter, you can use the following syntax to start Export in interactive mode:
exp username/passwordExport will display commonly used parameters with a request for you to enter a value. This method exists for backward compatibility.
let me know if you have any further query! -
Auto-generate table or list from other data
Hello,
I'm trying to figure out how to get Numbers (if it can) to generate and display a list. I'm not sure how to explain it well, so let me just give you an example.
I have a table that looks like this:
A 0
B 1
C 0
D 0
E 1
F 1
Where A through F are strings, and the 0 and 1s are determined by a formula based on other data in the spreadsheet. The point of the second column is to indicate if the corresponding item in the first column is "available" and can be chosen by the user, 1 meaning yes, 0 meaning no. So, for the example, all the requirements for "E" are met, and it can be chosen by the user; not so for "A." There are about 200 rows of data, so I'd rather have a formula or function than do it all manually.
I would like all the items (and only those items) in the first column that are available (as indicated by the second column) to be displayed in a table on a different sheet that the user is expected to interface with.
Hence, ideally that table would look like this:
B
E
F
and not like this:
(blank)
B
(blank)
(blank)
E
F
The goal is to then allow the user to select some or all of those available options (using check boxes in the next column). For what its worth, there's actually already a column before the string column that is a simple enumeration of rows; it's occurred to me that multiplying the "available" column by the enumeration will give a unique number for each available option and the same number, 0, for each unavailable option.
I really appreciate any advice you could give me!
Thanks!Tstedman,
You have to remember that checkboxes are just a pretty way of stating TRUE or FALSE. There is no mechanism other than to click on them to change them. They are not controlled by formula.
Knowing nothing about how you are using the checkbox in you tables, the following is offered as a possible workaround. In this scenario you may change the checkbox setting in table 1 and the change will be reflected in Table 2. But the down side is that the reverse will not work and that a check "mark",not a check "box", appears in Table 2. Column B of Table 2 contains the formula:
=IF(ISBLANK(A2),"",IF(LOOKUP(ROW()-1,Table 1 :: C,Table 1 :: D),"√",""))
If this works for you, Great! If not, others may come up with a different workaround. The checkbox can be useful in cases where formulas in other cells refer to it ... but, it cannot refer to other cells.
pw -
Going from one table view to another
Hey there,
I am new to creating apps and have a minor problem.
I have my table view controller attached to my nav bar and it displays data from an array and has a detail disclosure indicator for 3 rows.
I don't know what code to put in the prepare for segue function cause I want it to goto the next view controller which is a table view controller that also reads from an array.
so 2 table views, both with arrays, how do I display the 2nd table view controller from the first, as I DON'T need to pass any data.
Thanks in advance!I don't know what code to put in the prepare for segue function cause I want it to goto the next view controller which is a table view controller that also reads from an array.
The 2nd table view controller should be the destination view controller of the push segue. You do not need to override prepareForSegue unless you want to set properties on the destination view controller before it is loaded (i.e. pass data). -
Loaded dump from 12.5.4 to 15.7, Error 622 & Tables/Views not found
Hi all,
I am getting desperate trying to fix that issue. I had to import a dump from an ASE 12.5.4 into a new database on an ASE 15.7. I therefore enabled the compatibility mode server-wide and then proceeded to the load which seems to have performed correctly. The database seems well imported, and I can access most of the tables/views/procedures (from my C# application), but a procedure is giving me troubles.
I am getting this error while executing a given procedure :
Error: 622, Severity: 20, State: 1
Opentable was passed a varno of 52. Object 'temp worktable' in database 'tempdb' already has that session descriptor in use. This occured while opening object id -1245236 in database id 2.
I realised this was caused by a view which is used in this procedure but which is weird is that the error is not thrown when running the SQL code itself, out of the procedure context.
I am using Toad for Sybase as a client, and realised I cannot access the data tab of the concerned view, Toad gives me the same error. So I cannot execute this view while it performs without any trouble on the original server (production server which runs ASE 12.5.4).
I also realised, when trying to execute some pieces of the query individually that I get warnings about unfound tables (and that I should use sp_help to fix the problem). Although, the tables actually exists and I can access their data.
I have tried so many things and still cannot fix this problem. I've used 'upgrade_object', 'sp_recompile' on all tables, 'dbcc reindex' on all tables.
Would you have any idea where the problem could come from? Thank you very muchThank you for your reply.
Good to know that enabling compatibility mode before or after loading the load doesn't have any effect.
I didn't drop/recreate all the SP and views but I can tell you I recreated a similar view and it causes the same issue.
I had a look at your link yes. I have run 'dbcc upgrade_object' several times already, on the view and the procedures calling the view, and it won't solve anything.
I've seen a similar post about the problem I have when executing the code itself of the view in a "normal" adhoc query (errors saying the tables are not found) : SAP Sybase Forums - ASE - Backup and Recovery - PRoblem after restore - Object does not exist.
Could it be the same problem for me?
Although I've tried splitting the SQL query and executing the parts individually and it works without any trouble. Problem is when the 2 parts of the view are put together. It may be something that was possible with ASE 12.5.4 but not with 15.7 and that compatiblity mode doesn't solve. My view consists of an union a two selects where both have left joins, case when then else, not in and a final group by (adding an order by doesn't help, as I tried).
PS : I don't have access to the production server where the dump is actually from (but I could if it is really necessary) -
i would like to make my java application automaticaly convert a given .xsd file to an .xml one.
i know that with jdev you can generate an xml file from xsd one, and i want my application do the same thing.
i know also that i can use JAXB: first i bind the xsd file then i marshall the java class created to obtain xml. But i dont know how to do it.
is there a simple way to use the "things" behind the jdev xml generation from xsd.Please refer
http://www.developer.com/java/web/article.php/3722211/Using-JAXB-in-JDeveloper-1013.htm
JDeveloepr 11g includes JAXB 2.0. -
Generating XML instance from XSD
Hi,
I want to know ( java program etc ) to generate XML instance from XSD. How tools ( XML Spy, Oxygen ) generate sample XML file from XSD. What APIs can be used for generating XML from XSD and what APIs are used for checking If XML instance conforms to a XSD? Is it big deal to implement it?
Thanks in advance
SandeepTo validate xml against XSD , I found I can use the existing parsers( using JAXP which has SAX and DOM APIs ) in current JDKs and validate. I still did not find the best way to generate xml from XSD and how tools like xml spy and oxygen generates sample xml file from xsd.
Thanks
Sandeep -
XSD from Database table/view/procedure
Hi all,
Does anyone know of a tool or framework which enables generation of XSD's out of a Database table/view/procedure?Hi Naval,
It depends on whether you created a BOL model for your Z-table or not. If you don't have a BOL model, then all you can do is use a value node. In that case, you need to add attribute that you want to show in the value node, read the values from the z-table and add them to the node. You can create method(s) in view implementation class to read values from database table and fill the context node. From where these methods should then be called will depend on your requirement.
Regards,
Shiromani -
Add data to table view from input fields in a page
Hi
I am developing a BSP page which will be called from SRM shop transaction. After user enters the line item data, data will be passed back to shop transaction using OCI interface and the page attributes (URL).
(1) How can I add data from input fields to table view on a page on a button click? I am able to add first line but I could not retain first line data when I try to add the second line.
I am able to add multiple lines to table view if I use view and controller by adding to the line data to static attribute of the controller. I cant use the controller and view because I can not set the attribute to Controller automatically.
(2) Is there a way to pass an attribute (URL) to controller from SPRO? Like we pass an attribute to page automatically (Automatic page attribute).
(3) How can I call a controller and view and pass the page attribute to the controller on a button click from a page with out controller?
Thanks
SreenivasI'm trying to test the merge with the following data in a test.txt file:
ZZZZZ114923000004
1234Z400660000001
ZZZZZ114923000010
Getting an error:
SQL> @C:\dataformats\sql\pc12seriesMerge.sql
Directory created.
SP2-0552: Bind variable "17" not declared.
SQL>
here it the pc12seriesMerge.sql file
set serveroutput on
create or replace directory user_dir as 'c:\dataformats\incoming\';
DECLARE
v_filename VARCHAR2(100); -- Data filename
v_file_exists boolean;
v_file_length number;
v_block_size number;
f utl_file.file_type;
s varchar2(200);
lineString varchar(200);
v_account varchar(5);
v_IDN varchar(6);
v_quantity varchar(6);
BEGIN
v_filename := 'TEST.TXT';
DBMS_OUTPUT.PUT_LINE(v_filename); --shows filename
utl_file.fgetattr('USER_DIR', v_filename, v_file_exists, v_file_length ,v_block_size );
IF v_file_exists THEN
dbms_output.put_line('File Exists');
create table ext_table (
account varchar2(5),
idn number(6),
quantity varchar2(6)
organization external (
type oracle_loader
default directory user_dir
access parameters (
records delimited by newline
fields (
account position(1:5) char(5),
idn position(6:11) char(6),
quantity position(12:17) char(6)
location ('test.txt')
reject limit unlimited;
MERGE INTO id_req_stg t
USING (
SELECT account,
idn,
decode(quantity, '-', 0, to_number(quantity)) as quantity
FROM ext_table
) v
ON ( t.account = v.account AND t.idn = v.idn )
WHEN MATCHED THEN
UPDATE SET t.quantity = v.quantity
DELETE WHERE t.quantity = 0
WHEN NOT MATCHED THEN
INSERT (account, idn, quantity)
VALUES (v.account, v.idn, v.quantity);
ELSE
dbms_output.put_line('File Does Not Exist');
END IF; -- file exists
EXCEPTION
WHEN UTL_FILE.ACCESS_DENIED THEN
DBMS_OUTPUT.PUT_LINE('No Access!!!');
WHEN UTL_FILE.INVALID_PATH THEN
DBMS_OUTPUT.PUT_LINE('PATH DOES NOT EXIST');
WHEN others THEN
DBMS_OUTPUT.PUT_LINE('SQLERRM: ' || SQLERRM);
END;
/ -
How To Update A Table View From Client Side !!!!
Hi I would like to update a table view from the Client Side. So that the user can keep updating the relevent data on the client and when they have finally finished they can press Save so the entire page is then sent to the Server.
Does anyone know how to do this, I guess u have to use the EPCM, I have just started on it and would really appreciate some Help.
Thanks,
Emmanuel.This is what I found :-
There are a couple of ways to approach this.
1) load the excel spreadsheet into the database "as is". You can use interMedia
text to convert the .xls file into a .htm file (HTML) or use iFS (see
http://technet.oracle.com/
for
more info on that) to parse it as well. InterMedia text will convert your XLS
spreadsheet into a big HTML table (easy to parse out what you need at that
point)
2) Using OLE automation, a program you write can interact with Excel, request
data from a spreadsheet, and insert it. Oracle Forms is capable of doing this
for example as is other languages environments. In this fashion, you can remove
the "manual" and "sqlldr" parts -- your program can automatically insert the
data.
3) You can write a VB script that uses ODBC or Oracle Objects for OLE (OO4O) in
Excel. This VB script would be able to put selected data from the spreadsheet
into the database. We would recommend OO4O. It provides an In-Process COM
Automation Server that provides a set of COM Automation interfaces/objects for
connecting to Oracle database servers, executing queries and managing the
results. OO4O is available from
http://technet.oracle.com -
Generating an excel sheet from an oracle table
Hi,
What is the easiest way to generate an .xls report from oracle i.e. when the user for example views some records in an oracle table using SQL_FORMS I want to then give them a button where they get a simple .xls report of the records in the table.
I have heard 'ole' method is one way, is that the best method and how is it done exactly...?
ThanksHave you tried this?
CREATE OR REPLACE procedure print_reports is
cursor c_mgr is
select
t1.ename,
t1.empno
from
emp t1
where exists
(select
'x'
from
emp t2
where
t1.empno=t2.mgr);
cursor c_direct_reports (cv_mgr number) is
select
empno,
ename,
job,
hiredate,
sal
from
emp
where
mgr=cv_mgr;
wfile_handle utl_file.file_type;
v_wstring varchar2 (100);
v_header varchar2(100);
v_file varchar2(100);
v_date varchar2(20);
begin
select
to_char(sysdate,'dd_mon_yyyy')
into
v_date
from
dual;
v_header :='empno'||chr(9)||'ename'||chr(9)||'job'||chr(9)||'hiredate'||chr(9)||'sal';
for r_mgr in c_mgr loop
v_file := r_mgr.ename||'_direct_reports_'||v_date||'.xls';
wfile_handle := utl_file.fopen ('REPORTS',v_file, 'W');
utl_file.put_line(wfile_handle,v_header);
for r in c_direct_reports(r_mgr.empno) loop
v_wstring := r.empno||chr(9)||r.ename||chr(9)||r.job||chr(9)||to_char(r.hiredate,'dd/mm/yyyy')
||chr(9)||r.sal;
utl_file.put_line(wfile_handle,v_wstring);
end loop;
utl_file.fclose (wfile_handle);
end loop;
end print_reports;
Reference:
http://www.orafusion.com/art_excel.htm -
Generate xml output file from relational table
Hi All,
I'd like to generate an XML file from a relational table but would like to persist the XSD in Oracle does anyone have a working example?
Edited by: houchen on Jun 2, 2009 5:34 AMFrom the FAQ on the {forum:id=34} forum, {thread:id=416001}.
If you are wanting to register the schemas in Oracle, you will find info on that as well in the FAQ. -
Migration from Designer: wrong alias for used table/view in views
Hello,
I am using SQL DM version 3.3.0.744.
when importing a view from Designer, a query is build with aliases for the used tables/views which are the same as the table/view name. When using a where clause in Designer, you refer to the alias of the table/view, like t1.col1= t2.cola. Here t1 and t2 are the aliases of the underlying tables.
In Designer the following DDL is generated:
CREATE OR REPLACE FORCE VIEW VIEW5
(COL2
,COL1)
AS SELECT T2.COLA COL2
,T1.COL1 COL1
FROM TAB2 T2
,TAB1 T1
WHERE t1.col1= t2.cola
After importing the view in Data Modeler, the following DDL is generated:
CREATE OR REPLACE VIEW VIEW5 ( COL2,
COL1 )
AS SELECT
TAB2.COLA COL2,
TAB1.COL1 COL1
FROM
TAB2 TAB2,
TAB1 TAB1
WHERE
t1.col1= t2.cola ;
So by using the wrong alias, the where clause is invalid and the query builder doesn't show the joins.
The solution for this is to use the alias of the used table/view instead of the table/view name. Can you raise a bug for this?
Thanks in advance,
JoopThanks for your time. I did all possible way, but still the same problem. I mean
EXP 8... IMP 8
EXP 8... IMP 9
EXP 9... IMP 9
Today I found that, NLS_LANG of two databases are different. Oracle 8i is : WE8ISO8859P1
AND Oracle9i is : WE8MSWIN1252
So I created a new database from scratch with Oracle 8i character set :WE8ISO8859P1 and then use imp9i to import the file. Still the same problem.
Thanks,
Arash
Maybe you are looking for
-
RE: Report Builder issue
Hi! I'm trying to make a report which won't b based on any table. I want to key in 2 figures as parameters & display all figures btwn the two parameters, say. I have encounter two problems. 1. If i omit a select statement in the data model, then i'll
-
Arrowheads made using Stroke panel break when backsaved as an EPS?
Hello~! So I've noticed some fundamental differences between the features that WERE available under the "Add Arrowheads" feature, and the ability to add arrowheads that is now included in the Stroke panel. Insofar as I understand, there was not a way
-
Safari quit unexpectedly.. this happens with Firefox as well
Happens often.. Recently reinstalled OS.. Current is 10.8.2 ANY IDEAS???? REport posted below.. Model Name: MacBook Pro Model Identifier: MacBookPro8,1 Processor Name: Intel Core i7 Processor Speed: 2.7 GHz
-
Email address too long -- I can't read it!
Hi all. In the Address Book, when a contact has a very long email address, such as [email protected] , actually the iPhone shows a shortened version: maryelizabethmastrantonio@w... Now: how can I read it without clicking on EDIT? If I click on it, th
-
File open/close/read/write
open a file.. write text into file.. path in varchar2, filename in varchar2, firstline in varchar2, secondline in varchar2) is output_file utl_file.file_type; begin output_file := utl_file.fopen (path,filename, 'W'); utl_file.put_line (output_file, f