Sql statement generator for java.
Is there a (api's ) tool which generates sql statements given a database table, which can be embeeded into the application.
Dear Anand,
Try this one:
CASE balance WHEN 0 THEN 'Completed' ELSE CASE WHEN DATEDIFF(DD, EndDate, GetDate()) >= 0 THEN 'Progress' ELSE 'Pending' END END
I have assumed you don't have negative balance. It that is not true, give me the complete case.
Thanks,
Gordon
Thanks,
Gordon
Similar Messages
-
ANN: XML Class Generator for Java Available
The Oracle XMCL Class Generator for Java is now available as an
initial beta release on the Oracle Technology Network at
http://technet.oracle.com. Select 'xml' from the Technology menu.
The XML Class Generator will generate a set of Java source files
based on an input DTD. The generated Java source files can then
be used to construct, optionally validate, and print a XML
document that is compliant to the DTD specified. This is an early
beta release and has the following features:
* Creates Java Classes from DTDs to enable the programmatic
construction of XML documents.
* Supports validation mode to assist debugging.
* Works with the Oracle XML Parser in Java.
* Creates documents conforming to the W3C XML 1.0
Recommendation.
* Supports creating documents in the following encodings:
UTF-8
UTF-16
ISO-10646-UCS-2
ISO-10646-UCS-4
US-ASCII
EBCDIC-CP-US
ISO-8859-1
Shift_SJIS
Oracle XML Team
http://technet.oracle.com
Oracle Technology Network
nullThanks,
Rob
Oracle XML Team wrote:
: First, the link has been fixed. As to your access exception,
we
: have traced it to a difference between JDK 1.1.x and JDK 1.2.
: You can solve it by using a 1.1.x version of the JDK or wait
till
: our production version of our XML Parser becomes available
within
: a week which will work with 1.2.
: Oracle XML Team
: http://technet.oracle.com
: Rob Edagr (guest) wrote:
: : 1) The HREF on the download page for the NT version points
to
: : the version 102 parser not the classgen.
: : 2) After downloading and installing the classgen (by
guessing
: : what the url was) I ran it and get the following
: : C:\jdk1.2\xml\ora\classgen\sample>java SampleMain -root
: : wddxPacket wddx_0090.dtd
: : Exception in thread "main" java.lang.IllegalAccessError: try
to
: : access class oracle/xml/parser/XMLNode from class
: : oracle/xml/classgen/ClassGenerator
: : at oracle.xml.classgen.ClassGenerator.generate
(Compiled
: : Code)
: : at SampleMain.main(SampleMain.java:65)
: : Any idea on what the problem is (same error with sample dtd)
: : Rob
: : Oracle XML Team wrote:
: : : The Oracle XMCL Class Generator for Java is now available
as
: : an
: : : initial beta release on the Oracle Technology Network at
: : : http://technet.oracle.com. Select 'xml' from the
Technology
: : menu.
: : : The XML Class Generator will generate a set of Java source
: : files
: : : based on an input DTD. The generated Java source files can
: : then
: : : be used to construct, optionally validate, and print a XML
: : : document that is compliant to the DTD specified. This is
an
: : early
: : : beta release and has the following features:
: : : * Creates Java Classes from DTDs to enable the
programmatic
: : : construction of XML documents.
: : : * Supports validation mode to assist debugging.
: : : * Works with the Oracle XML Parser in Java.
: : : * Creates documents conforming to the W3C XML 1.0
: : : Recommendation.
: : : * Supports creating documents in the following
encodings:
: : : UTF-8
: : : UTF-16
: : : ISO-10646-UCS-2
: : : ISO-10646-UCS-4
: : : US-ASCII
: : : EBCDIC-CP-US
: : : ISO-8859-1
: : : Shift_SJIS
: : : Oracle XML Team
: : : http://technet.oracle.com
: : : Oracle Technology Network
: Oracle Technology Network
null -
Query to return all SQL statements ran for a particular user.
Good Morning,
Is it possible to find all the SQL statements run for a particular user using the v$ views? I can do it it 10g however I am currently using 9i and the query below does not work.
select a.username,a.logon_time,b.sql_fulltext
from v$session a,v$sqlarea b
where a.sql_id=b.sql_id
and a.username='USER'
order by a.logon_time descI assume some columns in these views do not exist in 9i. The release of 9 I am using is 9.2.0.1.0.
You help is much appreciated.
Thanks,
Mark.Dear Mark!
I suggest you to use auditing instead of v$sqlarea. Oracle Onlinedocumentation says the following about v$sqlarea:
>
V$SQLAREA lists statistics on shared SQL area and contains one row per SQL string. It provides statistics on SQL statements that are in memory, parsed, and ready for execution.
>
That means that you'll get only those SQL-Statements that are currently in memory. Older statements which are already deleted from memory are not visible for your query.
By the way if you simply want to know what is wrong with your query then please post your errormessage.
Yours sincerely
Florian W.
Edited by: Florian W. on 29.07.2009 12:03 -
SQL Statement needed for Query Generator
Dear Experts,
My view has the following three columns.
1, Start Date
2. End Date
3. Balance.
I need an SQL statement to write in query generator, which has to check if EndDate is less than the Current date and balance is above zero. If so, it assumes the last date of the job is already over, outstanding materials not yet been returned. Hence it has to return 'Pending'. If EndDate is greater than current date, it means final date for completion of the process is yet to come. So the task is in progress, hence it has to return 'Progress'. If the balance is Zero, all materials connected with the task have been received either as a FG or as Raw Materials. So it has to return, 'Completed'. I need a singe SQL Statement for this.
Please help me.
Thanks in advance.
Regards
AnandDear Anand,
Try this one:
CASE balance WHEN 0 THEN 'Completed' ELSE CASE WHEN DATEDIFF(DD, EndDate, GetDate()) >= 0 THEN 'Progress' ELSE 'Pending' END END
I have assumed you don't have negative balance. It that is not true, give me the complete case.
Thanks,
Gordon
Thanks,
Gordon -
BEx queries - one or more SQL statements generated?
Iu2019m a BusinessObjects man and BEx is new to meu2026When you execute a BEx query against a cube u2013 how does BEx manage that query and what gets send to the backend DB (e.g. Oracle)?
I understand the cube is one table in Oracle?, but other tables (dimensions?) will also be needed to return all the data for a given report/query.
Does BEx pass that as one query to Oracle, or is it performed as separate queries, with BEx pulling the result sets together?Hi Durgesh, Susan
Thank you to both of you for your response to Ed on this thread. The background to these questions on how SQL statements are generated from BEx queries that we are working with Ed in a project to test the capability of accelerating the performance of BEx queries via the following process described below. (Please excuse any terminology errors as like I do not have a background in SAP):
1. Export fact table InfoObjects relevant to queries for InfoCubes to be accelerated by defining as Open Hub destinations, creating mappings and a data transfer process. Trigger export from SAP BI via a Process Chain and then load data to external database via ETL tool. Master data (dimension tables) remain in SAP BI
This step was completed successfully, including exporting of data.
2. Create a Universal Data Connect (UDC) source system to map to the exported fact tables.
3. Create a virtual provider mapping to the UDC source defined in step 2 to enable access to external table via JDBC.
4. Execute BEx report, selecting the query properties 'Cache inactive' and 'Reading all data at once', specifying restrictions (variables) in the report which would result in a small subset of data being returned from the fact table if applied in the SQL passed to the external database.
We hoped that SAP BI would push down predicates which could be applied to the fact table into the SQL sent to the external database via the virtual provider, but instead an SQL query selecting all columns with no WHERE clause was generated with the result that a 36 million row results set was sent across a network to join with dimension data, rather than a few rows.
Is this how SAP BI works in version 7.0 or are there configuration options which can change this behaviour? Is so, if all tables (including master data (dimensions) were exported to external database would SAP BI then transmit the database queries as joins to the external database?
Sorry this was a bit long, and thank you in advance for any advice you can give.
Stuart. -
Logging/viewing SQL statements generated by the SQL Developer IDE?
I know it is possible to view the SQL statements that the SQL Developer IDE generates to fetch result-sets from the database whenever one performs any action - say expanding the "Tables" node for a database, for example. I would appreciate if someone could point out how this functionality could be enabled.
Thanks,
RGIn 1.0, you could use the AddVMOption -Daudit.trace=db_api option inside the sqldeveloper.conf file.
In 1.1 however, I don't get output inside the console anymore (for expanding trees, etc.).
Kris, has this option been replaced by another one? Please let us in on all the fun ;-)
K. -
XDK for PL/SQL vs XDK for Java
Hi ,
I am trying to find what version of XDK and whether it is for java or PL/SQL. I am confused after what I saw in our environment. Please clarify..
When I run the getReleaseVersion() and do a
select xmlversion from dual,
I get
Oracle XDK Java 9.0.1.1.0A Production
Does this mean we have XDK for Java? not for PL/SQL?
I also see PL/SQL packages for XMLDOM,XMLGEN.XMLPARSER,XSLPROCESSOR,DBMS_XMLQUERY,DBMS_XMLSAVE.
Does this mean I have/not XDK for PL/SQL??
Please clarify.XDK for PL/SQL is built based on XDK for Java. So that's why you got the result. It should also reflect the version you use.
-
How to view the SQL statement generated during execution of the BW Query?
Dear Experts,
I am trying to retrieve data in a SAP BW Query from a Non-SAP system.
I think if I am able to see the complete SQL statement that was generated when I executed the BW Query, I may be able to use it to retrieve the data.
Do you know how and where I can see the SQL statement of a BW Query's SQL statement?
I tried RSRT options to execute the Query but still could not find the SQL statement.
Thanks in advance.
Regards,
Shunhui.hi
goto rsrt
give your query name
select execute + debug option
in the debug option under data manager check the check box "display SQL/BIA query
selcet continue
you can see the sql statement
thanq -
SQL Developer asks for java.exe with the version that has java built in.
I have a user with the following platform:
Windows XP2
SQL Developer Version 1.5.4
The version they are trying to get running is the one that has the JDK built in. However, when they try and startup SQL Developer it asks for the location of java.exe.
However, when I run the same exact version on my workstation, I do not receive the prompt for a java.exe.
I checked the documentation, and I couldn't find anything related to this particular issue, however I may have missed it.
Can anyone provide me with any guidance please? Thanks.Resolved. There was a difference of permissions on the user's machine.
-
Java.beans.Statement & java.sql.Statement
My old code from jdk1.3.1 throws the ambiguous class thingie-mo-bob. Why did they implement the new java.beans.Statement, and is there anyway to make it default to the old java.sql.Statement without having to go through all the old code and add import java.sql.Statement. I have like 200 jsp files 'n it will take a loooong time!
PeteThere r two ways to do this.
(i) One is Implement the java.sql.Statement
like
package java.beans;
public interface Statement implements
java.sql.Statement {
}What? Are you suggesting he edit the source code for java.beans.Statement and make it implement java.sql.Statement?? I would most certainly not suggest that solution- beside violating the licensing agreement, it has troubling consequences since you are basically redefining the structure of a class in a way that makes no functional sense- that is, there is no reason for java.beans.Statement to implement methods like getConnection() and the other signatures of java.sql.Statement.
I'm not sure if I'm reading your response correctly or not, but I would definitely not refactor java.beans.Statement just to get this problem solved with out editing files ... ... since java.sql.Statement is used so widely, perhaps they should have considered a different name for java.beans.Statement , although you hate to base a name off of what's going to cause the least problems, rather then what makes the most sense ... ... any way, I guess it doesn't matter now: the name has been selected .... I'd be interested to hear how you solved the problem. -
I want to know where do I find the SQL statements generated by
the migration utility for Oracle 8.1.5 from Access.
Also where does the errors get logged?
Thanks in advance.
nullhi donal,
in my case even the same thing is happening Oracle workbench is having stored procedures in omwb_emulation like cdate, int_ , time_,time_1 (which i think are system functions provided by sql server, i don't understand why they are being migrated and stored under omwb_emulation?) also two packages with the name of globalpkg and utilities are created under omwb_emulation schema.
Which i have seen is being referenced a lot of times in converted PL/SQL Stored procedures like everytime a select statement in a SQL Server procedure is converted to some code which references omwb_emulation.globalpkg. I am not able to comprehend what's the reason behind this. can somebody through light on this and let me know is it really required? -
DBIF_RSQL_INVALID_RSQL The maximum size of an SQL statement was exceeded
Dear,
I would appreciate a helping hand
I have a problem with a dump I could not find any note that I can help solve the problem.
A dump is appearing at various consultants which indicates the following.
>>> SELECT * FROM KNA1 "client specified
559 APPENDING TABLE IKNA1
560 UP TO RSEUMOD-TBMAXSEL ROWS BYPASSING BUFFER
ST22
What happened?
Error in the ABAP Application Program
The current ABAP program "/1BCDWB/DBKNA1" had to be terminated because it has
come across a statement that unfortunately cannot be executed.
Error analysis
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_OPEN_SQL_DB', was not caught
and
therefore caused a runtime error.
The reason for the exception is:
The SQL statement generated from the SAP Open SQL statement violates a
restriction imposed by the underlying database system of the ABAP
system.
Possible error causes:
o The maximum size of an SQL statement was exceeded.
o The statement contains too many input variables.
o The input data requires more space than is available.
o ...
You can generally find details in the system log (SM21) and in the
developer trace of the relevant work process (ST11).
In the case of an error, current restrictions are frequently displayed
in the developer trace.
SQL sentence
550 if not %_l_lines is initial.
551 %_TAB2[] = %_tab2_field[].
552 endif.
553 endif.
554 ENDIF.
555 CASE ACTION.
556 WHEN 'ANZE'.
557 try.
>>> SELECT * FROM KNA1 "client specified
559 APPENDING TABLE IKNA1
560 UP TO RSEUMOD-TBMAXSEL ROWS BYPASSING BUFFER
561 WHERE KUNNR IN I1
562 AND NAME1 IN I2
563 AND ANRED IN I3
564 AND ERDAT IN I4
565 AND ERNAM IN I5
566 AND KTOKD IN I6
567 AND STCD1 IN I7
568 AND VBUND IN I8
569 AND J_3GETYP IN I9
570 AND J_3GAGDUMI IN I10
571 AND KOKRS IN I11.
572
573 CATCH CX_SY_DYNAMIC_OSQL_SEMANTICS INTO xref.
574 IF xref->kernel_errid = 'SAPSQL_ESCAPE_WITH_POOLTABLE'.
575 message i412(mo).
576 exit.
577 ELSE.
wp trace:
D *** ERROR => dySaveDataBindingValue: Abap-Field= >TEXT-SYS< not found [dypbdatab.c 510]
D *** ERROR => dySaveDataBindingEntry: dySaveDataBindingValue() Rc=-1 Reference= >TEXT-SYS< [dypbdatab.c 430]
D *** ERROR => dySaveDataBinding: dySaveDataBindingEntry() Rc= -1 Reference=>TEXT-SYS< [dypbdatab.c 137]
Y *** ERROR => dyPbSaveDataBindingForField: dySaveDataBinding() Rc= 1 [dypropbag.c 641]
Y *** ERROR => ... Dynpro-Field= >DISPLAY_SY_SUBRC_TEXT< [dypropbag.c 642]
Y *** ERROR => ... Dynpro= >SAPLSTPDA_CARRIER< >0700< [dypropbag.c 643]
D *** ERROR => dySaveDataBindingValue: Abap-Field= >TEXT-SYS< not found [dypbdatab.c 510]
D *** ERROR => dySaveDataBindingEntry: dySaveDataBindingValue() Rc=-1 Reference= >TEXT-SYS< [dypbdatab.c 430]
D *** ERROR => dySaveDataBinding: dySaveDataBindingEntry() Rc= -1 Reference=>TEXT-SYS< [dypbdatab.c 137]
Y *** ERROR => dyPbSaveDataBindingForField: dySaveDataBinding() Rc= 1 [dypropbag.c 641]
Y *** ERROR => ... Dynpro-Field= >DISPLAY_FREE_VAR_TEXT< [dypropbag.c 642]
Y *** ERROR => ... Dynpro= >SAPLSTPDA_CARRIER< >0700< [dypropbag.c 643]
I thank you in advance
If you require other information please requestHi,
Under certain conditions, an Open SQL statement with range tables can be reformulated into a FOR ALL ENTRIES statement:
DESCRIBE TABLE range_tab LINES lines.
IF lines EQ 0.
[SELECT for blank range_tab]
ELSE.
SELECT .. FOR ALL ENTRIES IN range_tab ..
WHERE .. f EQ range_tab-LOW ...
ENDSELECT.
ENDF.
Since FOR ALL ENTRIES statements are automatically converted in accordance with the database restrictions, this solution is always met by means of a choice if the following requirements are fulfilled:
1. The statement operates on transparent tables, on database views or on a projection view on a transparent table.
2. The requirement on the range table is not negated. Moreover, the range table only contains entries with range_tab-SIGN = 'I'
and only one value ever occurs in the field range_tab OPTION.
This value is then used as an operator with operand range_tab-LOW or range_tab-HIGH.In the above example, case 'EQ range_tab-LOW' was the typical case.
3. Duplicates are removed from the result by FOR ALL ENTRIES.This must not falsify the desired result, that is, the previous Open SQL statement can be written as SELECT DISTINCT.
For the reformulation, if the range table is empty it must be handled in a different way:with FOR ALL ENTRIES, all the records would be selected here while this applies for the original query only if the WHERE clause consisted of the 'f IN range_tab' condition.
FOR ALL ENTRIES should also be used if the Open SQL statement contains several range tables.Then (probably) the most extensive of the range tables which fill the second condition is chosen as a FOR ALL ENTRIES table.
OR
What you could do in your code is,
prior to querying;
since your select options parameter is ultimately an internal range table,
1. split the select-option values into a group of say 3000 based on your limit,
2. run your query against each chunck of 3000 parameters,
3. then put together the results of each chunk.
For further reading, you might want to have a look at the Note# 13607 as the first suggestion is what I read from the note. -
Using SQL Statements in Error Exceptions
Is there any way to include SQL statements within my catch routines (i.e.
catch (java.io.IOException ex) {
System.out.println("An error occurred whilst writing to the message buffer: " + ex);
#sql { INSERT INTO DEBUG_TBL(CURRENT_DT,PROGRAM_ID,DEBUG__MESG) VALUES (SYSDATE,'TEST',:ex) };
#sql { COMMIT };
As it stands I get the following error upon compile:
Error: Unsupported Java type for host item (at position#1): java.io.IOException
Any help would be greatly appreciated.
Thx,
Boybles
nullYou can use SQL statements in your catch blocks, just not SQL statements that use Java types which do not map to SQL.
You cannot pass exceptions from Java to SQL. You can catch a SQL exceptions as a SQLException in Java. However, any exception that is thrown by a Java Stored Procedure (including SQLException) is rendered as an "Uncaught Java exception" in SQL.
When you receive a SQLException there is information about the originator, the error message, etc. in the exception object. See:
http://technet.oracle.com/docs/products/oracle8i/doc_library/817_doc/java.817/a83723/keyprog5.htm#1004462
While you cannot insert a Java exception per se into a table, you can extract the message string(s)/code and insert that in a table. -
Folks
I need to separate SQL statements from Java Code, How do i put these SQL Statements in an XML file and how to access these SQL statements from a Java code,
Any help with sample code is greatful,The use of entities as kstc_jyu may help. It really depends on how you design the XML vocabulary based on the expected usage (e.g., if the SQL statements change very often).
Back to the original question, I am right to interpret "how to use SQL statements in XML ?" as how to design an XML vocabulary to store SQL statements?
If not, you can simply use the scheme proposed by DrClap. Reading and extracting the SQL statement would be just as you would with any other XML document. Google for a Java XML tutorial. -
Hi All,
I was trying to execute a standard function module in which there is a sql statement where IN operator is used.
The no of choices given for that field by the IN operator is 1065.
The error displayed is the SQL statement generated from the SAP Open SQL statement violates a restriction imposed by the underlying database system of the ABAP system.
But when I am reducing the no of choices for that filed to 1000 the function modules executes smoothly.
Now from all these I can understand that there is some restriction imposed by underlying database for the no of choices by IN operator in select statements. I want a way to override that restriction.
The function module I was executing is 'K_PRCTR_VALUES_GET'. The error hits at line no 162 when the table t_selopt contains 1065 line items. Now this function modules gives us all the profit centers based on Profit-center group. So according to the current scenario for the respective profit-center group there are 1065 no. of profit centers. So there is no way that we can reduce the no. of profit centers for profit center group rather I have to find the other way out.
I will really appreciate the inputs. Please help me out in with this problem. Points will be awarded for good answer.
Thanks in advance.
Regards,
Piyush KothariIndeed there is a limit to the SELECT-OPTIONS / RANGES with the IN operator. But unfortunately there is no way bypass this limitation.
The only thing you can do (sort of workaround) is to call the function module several times for x-number of profit centers (if possible in your particular case).
It might be an option to talk to one of your basis administrators, perhaps they have another solution for this. But from ABAP side there is nothing you can do about it.
Maybe you are looking for
-
I need to use my time capsule as an external HD
I bought a time capsule recently and not knowing what i was doing, I copied my music and movies library over to it into the "data" folder. I think I screwed up because every time I try to play it in itunes the destination changes, and I can't bring t
-
Recommendations please on Exchange 2013 resources
I am migrating users and resources from Ex2007 to Ex2013. I have several different mailboxes on 2007 that are set up as "users", but they are really more of a shared resource Calendar, for departments to use for "time off" or departmental to do list
-
Import Purchase order-Condition type and pricing procedure
In purchase order (IMPORT) has 500 line items. For each line item having customs condition type (BCD, cess, HScess, CVD, cess, HScess, Additional duty). For this manual entry is very difficult to entry. By default condition type can pick default % or
-
Hi everyone! I'm customizing a validation for PS, but as far as I can see, it only takes place when the project is saved. Does anyone know if there's any way in which the system can execute the validation when the data enty is taking place? What I'm
-
[SOLVED] Configuring software accesspoint
Hi. I need some guidence as my knowledge is somewhat limited. There are 3 interfaces and one of them is wireless: eno1, enp2s0, wlp3s0 I would like to achieve something like this: INTERNET <--> eno1 | NAT | enp2s0,wlp3s0 <--> wired & wireless clients