Generate DDL formatting data incorrectly
Greetings all,
So I appear to have found the issue with my Generated DDL File. It is formatting the lines incorrectly and I have to manually go in and clean it up.
For example:
ALTER TRIGGER "BI_MIMPBM_CA_GROUP_LKP" ENABLE;CREATE OR REPLACE TRIGGER "BI_MIMPBM_CAT_LKP"
before insert on "MIMPBM_CAT_LKP"
for each row
begin
if :NEW."CATID" is null then
select "CAT_LKP_SEQ".nextval into :NEW."CATID" from dual;
end if;
end;Notice how the ENABLE;CREATE are on the same line. That throws an error. I am not sure why as I thought the ; ended a piece of code, but when I do a carriage return on it and then put it in, it works. I am using Application Express 4.0.2.00.07 and not sure if it is the application or something I am doing in the formatting of my code when I create anything.
Is anyone else having this issue when generating DDL files? If so, is there a work around besides going through the whole script and adding carriage returns as necessary?
Thanks
Wally
Is Page 5 of Data Modeling (How to generate DDL(sql) scripts to create a database) of any help?
Similar Messages
-
Generate DDL for objects (just for fun)
I'm been putting together queries that generate DDL. Considering exp/imp ROWS=0 can be used, or DBMS_METADATA there is little point. Though, with restricted access those may not be possible options, but then an external tool like TOAD could do it. Therefore, my justification for this is "just for fun".
Here is one for TABLEs. It does not generate the CONSTRAINTs (which i try to get in the next query), and no storage clauses. This query is also formatted for fixed width font with tabs equivalent to eight characters:
SELECT
SUBSTR
REPLACE
CASE
WHEN Columns.Column_Id = 1 THEN
'CREATE TABLE ' || Columns.Table_Name
|| CHR(10) || '('
|| CHR(10)
END
|| ' ' || Columns.Column_Name
|| RPAD(CHR(09), Tabs - FLOOR((LENGTH(Column_Name) +1) / 8), CHR(09))
|| Data_Type
|| CASE
WHEN Data_Type IN ('CHAR', 'VARCHAR2') THEN '(' || Char_Length || ')'
WHEN Data_Type = 'FLOAT' THEN '(' || Data_Precision ||')'
WHEN Data_Type = 'NUMBER' THEN
CASE WHEN Data_Precision IS NOT NULL THEN '(' || Data_Precision
|| CASE WHEN Data_Scale IS NOT NULL THEN ', ' || Data_Scale END
||')'
END
END
|| CASE
WHEN Data_Default IS NOT NULL
THEN
RPAD
CHR(09),
CASE Data_Type
WHEN 'CHAR' THEN CASE Char_Length WHEN 1 THEN 2 ELSE 1 END
WHEN 'DATE' THEN 2
ELSE 1
END,
CHR(09)
|| 'DEFAULT '
|| (
SELECT
ExtractValue
DBMS_XMLGEN.GetXMLType
SELECT
Data_Default
FROM
All_Tab_Columns
WHERE
Owner = ''' || Columns.Owner || '''
AND Table_Name = ''' || Columns.Table_Name || '''
AND Column_Name = ''' || Columns.Column_Name ||'''
'ROWSET/ROW/DATA_DEFAULT'
FROM
Dual
END
|| CASE
WHEN Columns.Column_Id = Info.Total_Columns
THEN CHR(10) || ');' || CHR(10) || CHR(10)
ELSE ','
END,
',' || CHR(10) || CHR(10),
',' || CHR(10)
1,
181
) Statement
FROM
All_Tab_Columns Columns,
SELECT
Owner,
Table_Name,
MAX(Column_Id) Total_Columns,
MAX(FLOOR((LENGTH(Column_Name) + 1) / 8)) + 1 Tabs
FROM
All_Tab_Columns
WHERE
Owner = 'SYS'
GROUP BY
Owner,
Table_Name
) Info
WHERE
Columns.Owner = Info.Owner
AND Columns.Table_Name = Info.Table_Name
ORDER BY
Columns.Owner,
Columns.Table_Name,
Columns.Column_Id;This next query get CONSTRAINTs. No formatting is used, because it becomes quite unweildy (though, if it used multiple lines, that would change). Another interesting thing is whether the CONSTRAINT names were generated or not. If they were generated, this still uses the old name and does not generate a new one:
WITH
Cons_Columns
AS
SELECT
Owner,
Constraint_Name,
SUBSTR
REPLACE
REPLACE
XMLAgg(XMLElement("A", Column_Name)
'<A>',
'</A>'
4
) || '"' List
FROM
SELECT
Owner,
Constraint_Name,
Column_Name
FROM
All_Cons_Columns
ORDER BY
Position
GROUP BY
Owner,
Constraint_Name
SELECT
'ALTER TABLE ' || Table_Name
|| ' ADD CONSTRAINT ' || Constraint_Name
|| ' '
|| CASE Constraint_Type
WHEN 'C' THEN 'CHECK'
WHEN 'U' THEN 'UNIQUE'
WHEN 'P' THEN 'PRIMARY KEY'
WHEN 'R' THEN 'FOREIGN KEY'
END
|| '('
|| CASE
WHEN Constraint_Type = 'C' THEN
SELECT
ExtractValue
DBMS_XMLGEN.GetXMLType
SELECT
Search_Condition
FROM
All_Constraints
WHERE
Owner = ''' || Cons.Owner || '''
AND Constraint_Name = ''' || Cons.Constraint_Name || '''
'ROWSET/ROW/SEARCH_CONDITION'
FROM
Dual
WHEN Constraint_Type IN ('P', 'R', 'U') THEN
SELECT
List
FROM
Cons_Columns
WHERE
Cons_Columns.Owner = Cons.Owner
AND Cons_Columns.Constraint_Name = Cons.Constraint_Name
END
|| ')'
|| CASE Constraint_Type
WHEN 'R' THEN
SELECT
' REFERENCES (' || List || ')'
FROM
Cons_Columns
WHERE
Cons_Columns.Owner = Cons.R_Owner
AND Cons_Columns.Constraint_Name = Cons.R_Constraint_Name
|| ' ON DELETE ' || Delete_Rule
ELSE ''
END
|| ' ' || DEFERRABLE || ' ' || DEFERRED
|| ' ' || VALIDATED || ' ' || STATUS || RTRIM(' ' || RELY)
|| ';'
FROM
All_Constraints Cons
WHERE
Owner = 'SYS'
ORDER BY
1,
Constraint_Name;Shoblock, thanx!
For NUMBER is was using a wrong COLUMN, and also in the wrong order. Serves me right for not following the documentation. And, i just ignored FLOAT. But not it mostly matches DESC (except this query shows the ", 0" where DESC drop it instead).
I fixed the query above.
The XML part that gets the long has a failure. If the Data_Default contains an XML special char it will get encoded. The way to not encode it, it looks, requires PL/SQL. Which means it would not be done in one query (without a FUNCTION).
I am curious if anyone else is interested in such queries, whether for "fun" or otherwise. -
Error while generating DDL commands using startSQLRepository for a new Repository
Hi,
I am trying to generate DDL Commands using startSQLRepository for my new repository SubashRepository so that I can use them to create new table structure.
All the repository related changes looks good. i can see my repository in ACC
When I run the command:
startSQLRepository -m SupremeATG –repository /com/supreme/SubashRepository /com/supreme/subashRepository.xml -outputSQLFile C:/ATG/ATG9.3/SupremeATG/config/com/supreme/subashRepositoryDDL.txt
I get following error:
Table 'SUBASH_MEMBER' in item-descriptor: 'member' does not exist in a table space accessible by the data source. DatabaseMetaData.getColumns returns no columns
Note:
* errors related to definition file were cleared as the same command threw relevant exception while trying to store a array property with out creating a multi table.
* Now this is the only exception i see
* Some DDL are getting generated in the output file, but those are related to inventory repository (I am not sure why this is happening as I have specifically gave the path to my definition file).
Any help in resolving this is highly appreciated.Pl post in the ATG forum
-
Does anyone know how to generate fixed format text file? I have few fields in the select which are null and hence messes up the file format, as space does not take up same amount of character width than any alphabets.
Basically I want to generate fixed length data file which is scheduled through DBMS_JOBS. I am using UTL_FILE utility.
Every suggestion are welcome
Thanks in advance for help :)
email your response at [email protected]hello,
using spaces as filler is sufficient. a space takes up the same room (one character) as any other letter in the alphabet.
if you look at the output in any word-processing tool or editor, that uses fonts like times, helvetica, arial, etc. those fonts are rendering the space-character smaller. in fact they are rendering each letter different. if you want to see what your output looks like, choose a font like courier.
if you just generate the file and then process it further, you should be OK. don't let you be fooled by what you see in your editor.
regards,
philipp -
Error When Refresh Formatted Data inside Excel Analyzer
I have build a Excel template and load up this to the BI Publisher Server. When I call this template after the log in works fine. When I refresh the data normal it works also fine, but when I try to refresh formatted Data I get the error "Error: This report does not support HTML as an output format." I will not use html output inside Excel, I will use the original Excel template with refreshed data.
Hi Tim,
The Refresh Formatted Data works on MS Excel 2003.
May need to check if its really supported on MS Office 2002.
Btw another question, is it possible to create an excel template without using Excel Analyzer?
Also when I used the generated excel file of Excel Analyzer as template, when the report is generated the data sheet sometimes is not filled with correct data or sometimes there is no data at all, even if the parameters used is the same as the one used in generating the original excel file using Excel Analyzer. This happens most of the time for reports with Concatenated Queries or SQL Queries using "CURSOR" to group a set of data. Note that on initial generation of excel file using Excel Analyzer, correct set of data is displayed. It is only when it is used as template and viewed/exported in Excel format that data is not properly loaded.
Please advise.
Thanks!
Uniz -
Error in outputting xml formatted data
Hello,
I'm trying to output xml formatted data using apex.
At about 70% into the formatted output I get this in the browser:
<descript>punct= & > < /,() &</descript>
</row>
- <row The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
Only one top level element is allowed in an XML document. Error processing resource 'http://apex.oracle.com/pls/otn/f?p=158...
<script language="JavaScript1.1" type="text/javascript">
-^
m">>
<DIVI have a 600 row table (dml below) with identical string in each row of the descript column. (I put in some special characters just to push it through the escape function for html. It is displaying the text correctly.)
The page has one report region (plsql below).
The page template is stripped down.
My local results are identical to the otn hosted workspace.
I did dump the table in xml format and displayed the dump file in browser without a problem, so I'm missing something in the code.
Thank you.
Albert
On OTN webspace, go to http://apex.oracle.com/pls/otn/f?p=15866:1:1291425545573680200:::::
plsql
declare
xdescript varchar2(4000);
begin
-- xml preface is in the page template
-- htp.p('<?xml version="1.0"?>');
htp.p('<rowset>');
begin
for item in
(select descript,cid from receipts order by cid)
loop
htp.p ('<row>');
xdescript := htf.escape_sc(item.descript);
htp.p('<cid>' || item.cid || '</cid>');
htp.p('<descript>'|| xdescript || '</descript>');
htp.p('</row>');
end loop;
end;
htp.p ('</rowset>');
end;
dml
CREATE TABLE "RECEIPTS"
( "CID" NUMBER,
"AMOUNT" NUMBER NOT NULL ENABLE,
"CLEARED" DATE,
"DESCRIPT" VARCHAR2(80),
"DATEENTERED" DATE DEFAULT SYSTIMESTAMP,
"CHECKNBR" NUMBER,
"CLEARSEQ" NUMBER DEFAULT 0,
CONSTRAINT "RECEIPTS_PK" PRIMARY KEY ("CID") ENABLE
CREATE SEQUENCE "RECEIPTS_SEQ" MINVALUE 1 MAXVALUE 999999999999999999999999999
INCREMENT BY 1 START WITH 4319 CACHE 20 NOORDER NOCYCLE
CREATE OR REPLACE TRIGGER "BI_RECEIPTS"
BEFORE INSERT ON "RECEIPTS"
FOR EACH ROW
BEGIN
SELECT "RECEIPTS_SEQ".NEXTVAL INTO :NEW.CID FROM DUAL;
END;
ALTER TRIGGER "BI_RECEIPTS" ENABLE
/May be it helps you. I use SQL/XML and APEX Application Process to generate XML succesfully
Here is the result:
http://htmldb.oracle.com/pls/otn/f?p=9774:101:0:APPLICATION_PROCESS=RSSNEWEVENTS
and here is the Process Text source:
declare
a clob;
begin
owa_util.mime_header( ccontent_type => 'text/xml', bclose_header => TRUE, ccharset => 'utf-8');
htp.prn('<?xml version="1.0" encoding="UTF-8"?>');
select
XMLTYPE.getStringVal(
XMLElement("rss",
XMLAttributes('2.0' as version),
XMLElement("channel",
XMLConcat(
XMLElement("title",'iActiveLife - novinky'),
XMLElement("link",'http://www.iactivelife.cz/'),
XMLElement("description",'iActiveLife - Zajímavý ivot snadněji'),
XMLElement("language",'cs'),
XMLElement("pubdate",''),
XMLAgg(
XMLElement("item",
XMLConcat(
XMLElement("title",event_name),
XMLElement("link",'http://htmldb.oracle.com/pls/otn/f?p=' || v('APP_ID') || ':37:' || v('SESSION') || '::NO::P37_EVENT_ID:' || event_id),
XMLElement("description",'')
) into a
from (
select event_id,event_name,issue_date, last_update_order
from (
select events.event_id, events.event_name, events.issue_date, rank () over (order by events.issue_date desc) as last_update_order
from events
where exists ( select * from opportunities where events.event_id=opportunities.event_id and opportunities.user_id is not null)
order by events.issue_date desc)
where last_update_order<=10
htp.prn(a);
end; -
How to generate n random dates
Can anyone help me in generating Random dates, i want to generate 100 random dates in yyyy-mm-dd format.
I've tried this, but will appreciate any neat solutions...
public static void main(String arg[]) {
int no = 0;
while (no < 100) {
// Year
int yylower = 1970; // your lower integer value
int yyupper = 2000; // the larger one of your two integers
double rand = Math.random();
int yyresult = yylower + (int) ( (yyupper - yylower) * rand);
// Month
int mmlower = 1; // your lower integer value
int mmupper = 12; // the larger one of your two integers
rand = Math.random();
int mmresult = mmlower + (int) ( (mmupper - mmlower) * rand);
// Month
int ddlower = 1; // your lower integer value
int ddupper = 29; // the larger one of your two integers
rand = Math.random();
int ddresult = ddlower + (int) ( (ddupper - ddlower) * rand);
System.out.println(yyresult + "-" + mmresult + "-" + ddresult);
no++;
} -
How to generate n random dates between 2 time periods
Hi,
I'm trying to write a method that generates n random dates between 2
time periods. For example, lets say I want to generate n random dates
between Jan 1 2003 and Jan 15 2003. I'm not sure how to go about
doing the random date generation. Can someone provide some direction
on how to do this?
The method signature should look like this.
public String[] generateRandomDates(String date1,String date2,int n){
// date1 and date2 come in the format of mmddyyyyhh24miss.
// n is the number of random dates to generate.
return dateArray;
Thanks.
Peterfirst take a look at the API concerning a source of randomness (Random might be a good guess), then take a look at stuff concerning dates (Date might be cool, maybe you will find some links from there).
Who wrote this stupid assignment? -
Generate DDL works in old version of SQL Developer, but not in new versions
Hello all,
How to generate DDL in new versions of Oracle SQL Developer for production Oracle database?
For production database, the generate DDL feature works fine in old versions (version 1.5.5) of Oracle SQL Developer, SQuirrel, Toad and many other similar tools, but not the new versions of Oracle SQL Developer (such as 2.1.1.64.45).
The SQL tab for a table is blank for me in production databases. Of course, it works fine in development Oracle database.
I did some research that many articles describe SELECT_CATALOG_ROLE as the required read-only role in production database. Our DBA did a test to grant me this role temporarily, and it worked for me to generate DDL using new Oracle SQL Developer. It is pain for me to ask for this role.
Is there a plug-in or work-around, so the new versions of Oracle SQL Developer can have this generate DDL feature in production without the mentioned SELECT_CATALOG_ROLE?
I could not find the answer in older forum threads.
For now, I will have to install older versions of Oracle SQL Developer.
ThanksI've seen a couple posts about people not being able to generate DDL for other users. To date, I've never seen a anybody post a workaround, nor have I seen one of the developers post a response, nor have I seen anybody say they've submitted a SR.
I think I remember reading somewhere that the new version of SQL Developer uses dbms_metadata.get_ddl to generate DDLS, rather than some custom query built on top of catalog views...which could explain why it use to work, but no longer does. But whether or not this is true, I don't know.
You could try submitting a SR and see if Oracle responds saying that it's a known bug and will be fixed in the next release. Until then, unless you get the role, you're stuck using something else for DDL generation. -
DM 3.0.0.665 instead of triggers not generating DDL correctly
There seems to be a bug in the DDL generation for manually created INSTEAD OF triggers on views. The INSTEAD OF trigger does not have the INSTEAD OF clause upon DDL generation. Instead, it has the BEFORE clause. It seems to be treating INSTEAD OF triggers as normal triggers. Note: When I reversed engineered a database that already had an INSTEAD OF trigger, it imported and generated DDL was fine. This bug shows itself when manually creating INSTEAD OF triggers.
Steps to replicate:
1. In any design that has a view.
2. In the physical model, find the view, expand it, right click to create Trigger for view
3. By definition, a trigger on a view can only be an instead of trigger.
4. The dialog box will have the 'Triggering time' showing as INSTEAD OF. You can't change it. (Which there is no reason to do anyway)
5. Generate DDL. When generating the DDL, the trigger will not be generated as INSTEAD OF, it will be generated as a BEFORE (INSERT/UPDATE/DELETE).
Included DDL generation from a simple database (I did not modify the DDL generated):
-- Generated by Oracle SQL Developer Data Modeler 3.0.0.665
-- at: 2011-03-30 13:16:32 EDT
-- site: Oracle Database 10g
-- type: Oracle Database 10g
-- CREATE DATABASE DB2
-- CONTROLFILE REUSE
-- MAXLOGFILES 1
-- MAXLOGMEMBERS 1
-- MAXLOGHISTORY 0
-- MAXDATAFILES 10
-- MAXINSTANCES 1
-- ARCHIVELOG
-- FORCE LOGGING
-- DATAFILE
-- '' SIZE 0 K REUSE
CREATE TABLE TABLE_1
Column_1 VARCHAR2 (1)
) LOGGING
CREATE OR REPLACE VIEW VIEW_1 ( Column_1 )
AS SELECT
TABLE_1.Column_1
FROM
TABLE_1 TABLE_1 ;
CREATE OR REPLACE TRIGGER Trg1
BEFORE INSERT ON VIEW_1
FOR EACH ROW
BEGIN
NULL;
END;
-- Oracle SQL Developer Data Modeler Summary Report:
-- CREATE TABLE 1
-- CREATE INDEX 0
-- ALTER TABLE 0
-- CREATE VIEW 1
-- CREATE PACKAGE 0
-- CREATE PACKAGE BODY 0
-- CREATE PROCEDURE 0
-- CREATE FUNCTION 0
-- CREATE TRIGGER 1
-- CREATE STRUCTURED TYPE 0
-- CREATE COLLECTION TYPE 0
-- CREATE CLUSTER 0
-- CREATE CONTEXT 0
-- CREATE DATABASE 1
-- CREATE DIMENSION 0
-- CREATE DIRECTORY 0
-- CREATE DISK GROUP 0
-- CREATE ROLE 0
-- CREATE ROLLBACK SEGMENT 0
-- CREATE SEQUENCE 0
-- CREATE MATERIALIZED VIEW 0
-- CREATE SYNONYM 0
-- CREATE TABLESPACE 0
-- CREATE USER 0
-- DROP TABLESPACE 0
-- DROP DATABASE 0
-- ERRORS 0
-- WARNINGS 0Hi,
Thanks for reporting this problem. I logged a bug on it.
David -
Generate DDL - change is a new column and I want to generate a alter table
Morning all,
I have searched and looked all over the data modeler and I cannot find this option ... yet I did find it easily in Designer.
I hope you can help me.
SQL Developer Data Modeler v3.0.0.665.
I have added a new column to a table and when I generate the DDL I would like it to be an alter table add column rather than a create table.
This feature is in Designer so I would think it would be in data modeler.
Just incase my description is not clear here are the high level steps so it is clear.
1. create the logical model
2. create the relational from the logical.
3. create the physical from the relational.
4. generate DDL and run in database. At this point I go to production with my system and all is well.
5. At this point we have an enhancement request. For the model it will be a new column in a table.
6. update logical model.
7. update relational from logical
8. update physical from relational
9. generate DDL. Here I would like to have the generate be aware the it needs only to generate an alter table add column and not create the table.
This is something I do alot as all my models are in production. I cannot find how to do this step of getting data modeler to generate the alter.
Designer does this exceptionally well.
Quite often it is more than a single column. The changes can be many and made over time and at the time of generating the DDL you may not recall every single change you made. To have the tool discover those changes for you and generate the appropriate DDL is a feature I regard as very high.
I hope this is clear and you can help me.
Cheers
Chris ....Hi Chris,
you need to compare your model against database - import from database into same relational model and use "swap target" option - in this case "alter statements" against database will be generated.
You can look at demonstrations here http://www.oracle.com/technetwork/developer-tools/datamodeler/demonstrations-224554.html
Probably this particular one will be most helpful http://download.oracle.com/otn_hosted_doc/sqldev/importddl/importddl.html
Soon or later your changes will require table to be recreated and you'll need to backup your data - you can consider usage of "Advanced DDL" option - script will be generated that will unload the content of your table (including LOBs) to file system accessible from database and restore it after changes. Well don't try it directly on production system :).
Philip -
BUG: Export DDL and Data fails for mixed case table/column names
Hi there,
I have found a bug in SQL Developer. See details below.
Description:
When "Export DDL and Data) function is used on a table/columns not named in UPPERCASE, sql generated by SQL Developer is invalid.
Steps to reproduce:
- open SQL Developer, connect to DB
- make a table named "lowerCase" (in double quotes, so it won't be automatically changed to capital letters)
- you may also add some columns, for example "lowerCol1", "UpCol2", ALLUPCOL3
- add some data rows to the table
- choose Tools -> Export DDL and Data
- check exporting of tables and data, on "filter" tabs choose your "lowerCase" table
- press "Apply"
Error:
Generated SQL contains invalid INSERTs: mixed-case table and columns are referenced without obligatory double quotes, which yields an error when generated script is executed (see below, relevant line is underlined)
-- DDL for Table lowerCase
CREATE TABLE "DBO_HT"."lowerCase"
( "lowerCol1" VARCHAR2(100),
"UpCol2" VARCHAR2(100),
"ALLUPCOL3" VARCHAR2(100)
-- DATA FOR TABLE lowerCase
-- FILTER = none used
-- INSERTING into lowerCase
Insert into lowerCase (lowerCol1,UpCol2,ALLUPCOL3) values ('lc','uc','auc');
-- END DATA FOR TABLE lowerCase
Remarks
SQL Developer: version 1.2.1, build MAIN-32.13
Oracle DBs: 9.2 & Express
OS: Windows 2000 Professional
If you need any more details/testing, let me know. I'd really appreciate a quick patch for this issue...
Alternatively, do you know of any other simple way of copying a single database (it's called a schema in Oracle, right?) from one computer to another? Possibly something so simple like detaching->copying->reattaching mdf (data) files in SQL Server... I thought that this "Export DDL&Data" function will do, but as you can see I couldn't use it.
I just need a simple solution that works - one operation on source to stuff, get the resulting files to other computer and one operation to have it running there... I think that such scenario is very basic, yet I just can't achieve it and I am simply not allowed to spend more time on it (read: our test project fails, my company rejects my "lobbying" and stays with MSSQL :/ )
Thanks a lot & byeThanks for your reply.
ad. 1)
You're right. I just wanted to give some very short feedback on my experiences with SQL Developer, so I didn't think starting new threads would be necessary, but as I was writing it became much bigger than I initially planned - sorry about that. I will make proper threads as soon as possible. Having "Edit post" button on this forum would also be useful.
ad. 2)
Generally, you're right - in most cases it's true that "switching DBMS is a major commitment" and "you will produce terrible code" if you don't learn the new one.
However, I think that you miss one part of market here - the market that I think Express is also targeted on. I'd call it a "fire&forget databases" market; MySQL comes to mind as possibly most common solution here. It's the rather small systems, possibly web-accessed, whose data-throughput requirements are rather modest; the point is to store data at all, and not necesarily in fastest way, because given the amount of data that is used, even on low-end hardware it will work well enough. What's important here is its general ease of use - how easy is to set up such system, connect and access data, develop a software using it, how much maintenance is needed, how easy this maintenance is, how easy are the most common development tasks as creating a DB, moving a DB from test to production server etc. There, "how easy" directly translates to "how much time we need to set it up", which translates to "how much will the development will cost".
Considering the current technology, switching the DBMS in such systems is not necesarily a major commitment and believe me that you will not produce terrible code. In many cases it's as simple as changing a switch in your ORM toolkit: hibernate.dialect = Hibernate.Dialect.OracleDialect vs MySQLDialect vs MsSql2005Dialect
Therefore, in some part of market it's easy to switch DBMS, even on project-by-project basis. The reason to switch will appear when other DBMS makes life easier => development faster. From that point of view, I can understand my colleagues giving me an embarassing look and saying "come on, I won't read all these docs just to have db copied to test server". And it doesn't mean "they are not willing to learn anything new", it's just that they feel such basic task should have self-explaining solution that doesn't require mastering any special knowledge. And if they get such simple solutions somewhere else, it costs them nothing to change the hibernate dialect.
I think Oracle did the great job with introducing the Express to this "fire&forget" market. The installation is a snap, it just works out of the box, nothing serious to configure, opposite to what I remember from installing and working on Oracle 9 a few years ago. In some places it's still "you need to start SQL*Plus and enter this script", but it's definitely less than before. I also find the SQL Developer a great tool, it can do most of what we need to do with the DB, it's also much better and pleasant to use over Oracle 9 tools. Still, a few basic things still require too much hassle, and I'd say taking your schema to another machine is one of them. So I think that, if you do it well, the "schema copy wizard" you mentioned might be very helpful. If I was to give any general advice for Express line of DB/tools, I'd say "make things simple" - make it "a DB you can't see".
That's, IMHO, the way to attract more Express users. -
Formatting data in table - jsp & jdbc
Hey there friends!
I was having a little problem formatting data and I was looking for help!
I want to format the data from jdbc as follows on a jsp page
THIS IS REPORT TO GENERATE
Name | Worked | Refused | Training | CarryOver
Jim | 10 | 5 | 2 | 5
Bob | 20 | 5 | 10 |
The resultset that I retrieve from my database is like this
RESULTSET
ID | Name | Type | Hours | CarryOver
1 | Jim | Worked | 10 | 5
1 | Jim | Refused | 5 | 5
1 | Jim | Training | 10 | 5
2 | Bob | Worked | 20 | 10
2 | Bob | Training | 5 | 10
Can anyone suggest what can be a done here?As you have learnt something it is only fair for me for reciprocate.
The code example I gave you was psuedocode - not real java. You need to add in a couple more things to make it work correctly.
First we want to create an entry in the hash, iff there is no record already there, otherwise, we want to get the value and add our new value to it (let's say the map is called map):
String key = record.name + "/" + record.type; // Using combination string as the key - simplest solution
Long hours = map.get(key);
if (hours == null) {
hours = new Long(record.hours);
} else {
hours = new Long(hours.getValue() + record.hours);
map.put(key, hours);It would be better to use your own class to hold the long value - as this would save all the construction calls. -
Has anyone else encountered problems when generating DDL Files for export?
I am using a hosted version of Application Express: Application Express 4.0.2.00.07 at this time and when I go to Generate a DDL file for export, it creates the file, but I am finding that it does not format the file correctly.
Is anyone else experiencing this?
Below is an example of what happens: (It seems that it does not do a carriage return between the ; at the end of a create statement and the CREATE that begins the next statement) <b> ;CREATE TABLE </b>
CREATE TABLE "ANALYST"
( "ANALYSTID" NUMBER,
"LASTNAME" VARCHAR2(30),
"FIRSTNAME" VARCHAR2(30),
"EMAIL" VARCHAR2(100),
"WORKPHONE" VARCHAR2(25),
"CELLPHONE" VARCHAR2(25),
"ONCALLSTATUS" VARCHAR2(25),
"ALTEMAIL" VARCHAR2(100),
"ALTMESSAGING" VARCHAR2(100),
"MESSAGING_TYPE" VARCHAR2(15),
"TEXT_CONTACT" VARCHAR2(50),
CONSTRAINT "ANALYST_PK" PRIMARY KEY ("ANALYSTID") ENABLE
) ;CREATE TABLE "APPLICATION_LOV"
( "APP_DISPLAY_VAL" VARCHAR2(255),
"APP_RETURN_VAL" VARCHAR2(255),
"PARENT_LOV" VARCHAR2(30),
"APP_LOV_GROUP" VARCHAR2(30),
"MSGID" NUMBER
) ;CREATE TABLE "RCCA_MAIN" It also seems to break on altering tables as well.
;ALTER TABLE "CORRECTIVE_ACTION" ADD CONSTRAINT "CORRECTIVE_ACTION_CON" FOREIGN KEY ("RCCAID")
REFERENCES "RCCA_MAIN" ("RCCAID") ON DELETE CASCADE ENABLE;ALTER TABLE "INC_NOTES" ADD CONSTRAINT "INC_NOTES_CON" FOREIGN KEY ("INCIDENT_ID")
REFERENCES "INCIDENT_DETAILS" ("INCIDENTID") ON DELETE CASCADE ENABLE;ALTER TABLE "PBM_LOB_SUBCATEGORY" ADD CONSTRAINT "PBM_LOB_SUBCATEGORY_CON" FOREIGN KEY ("LOB_NAME")
REFERENCES "PBM_LOB" ("LOB_NAME") ON DELETE CASCADE ENABLE;CREATE UNIQUE INDEX "ANALYST_PK" ON "ANALYST" ("ANALYSTID") So I am just seeing if this is a bug in this version of the application or if there is something I might be doing wrong when I generate the DDL for output to a script file.
To fix it, I open the file and add the add a carriage return between each CREATE statement and ALTER TABLE statement. This can be quite cumbersome if you have a large amount of tables involved in the application. It does work, but I just don't believe that to be the required action to port an application for export.
Thanks for any feedback
WallyWally
You don't need to access to your instance with SQL Developer. You can copy/paste the generated DDL code into the SQL Developer (downloand and install http://www.oracle.com/technetwork/developer-tools/sql-developer/overview/index.html), and use it for formatting the code.
Btw, yes generated DDL code has no carriage returns between create table codes (I tested)
Regards
Gokhan -
Version: 1.1.2.25 Main Build: 25.79
When selecting Generate DDL for a particular table the response is very slow and if one cancels the request SQL Developer freezes. Any thoughts/suggestions?
Thank you.generate ddl is only for the data definitons language
if you want to have complete data too
use the exp export utility built-in with the database....\\\\\\
Try It.
Edited by: vansul on 22 May, 2010 1:02 PM
Maybe you are looking for
-
I have got a problem here. Here I have a JFileChooser, I want to add in a FileFilter, and user could only see some type of file. But as long as I try to get the extension....It wont compile, could any one teach me how to get the extension of a file i
-
How to make sure that "hello" uses gmail to send the invites?
I am trying to invite someone to join a hello conversation but hello uses applemail in stead of my preferred gmail
-
Hi, I'm a CC 2014 user on my Mac. But, we have a PC here in our department that has an old copy of CS4 InDesign on it. It doesn't really need anything newer than that, for the work that's done with it. This PC just got a new hard drive. The old one c
-
Buenos dias, ¿Alguien me podria decir como abrir carpetas personales en el Outlook para mac?. Gracias.
-
Why my Macbook can not storage a screenshoot?
I have tried to take a screenshoot pressing Comand+Shift+(3or4) Then I hear the shot but it does not apper in the desktop. What can I do?