How to get nested table meta data
how to get nested table column name, column type and column size
by using java. i need code for this.
please help me.
The Follopwing program does display the the details of table. Hope you get the solution
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.Statement;
public class Main {
public static void main(String[] args) throws Exception {
Connection conn = getOracleConnection();
System.out.println("Got Connection.");
Statement st = conn.createStatement();
st = conn.createStatement();
ResultSet rs = st.executeQuery("SELECT * FROM SCHEDULE_SET");
ResultSetMetaData rsMetaData = rs.getMetaData();
int numberOfColumns = rsMetaData.getColumnCount();
System.out.println("resultSet MetaData column Count=" + numberOfColumns);
for (int i = 1; i <= numberOfColumns; i++) {
System.out.println("column MetaData ");
System.out.println("column number " + i);
// indicates the designated column's normal maximum width in
// characters
System.out.println(rsMetaData.getColumnDisplaySize(i));
// gets the designated column's suggested title
// for use in printouts and displays.
System.out.println(rsMetaData.getColumnLabel(i));
// get the designated column's name.
System.out.println(rsMetaData.getColumnName(i));
// get the designated column's SQL type.
System.out.println(rsMetaData.getColumnType(i));
// get the designated column's SQL type name.
System.out.println(rsMetaData.getColumnTypeName(i));
// get the designated column's class name.
System.out.println(rsMetaData.getColumnClassName(i));
// get the designated column's table name.
System.out.println(rsMetaData.getTableName(i));
// get the designated column's number of decimal digits.
System.out.println(rsMetaData.getPrecision(i));
// gets the designated column's number of
// digits to right of the decimal point.
System.out.println(rsMetaData.getScale(i));
// indicates whether the designated column is
// automatically numbered, thus read-only.
System.out.println(rsMetaData.isAutoIncrement(i));
// indicates whether the designated column is a cash value.
System.out.println(rsMetaData.isCurrency(i));
// indicates whether a write on the designated
// column will succeed.
System.out.println(rsMetaData.isWritable(i));
// indicates whether a write on the designated
// column will definitely succeed.
System.out.println(rsMetaData.isDefinitelyWritable(i));
// indicates the nullability of values
// in the designated column.
System.out.println(rsMetaData.isNullable(i));
// Indicates whether the designated column
// is definitely not writable.
System.out.println(rsMetaData.isReadOnly(i));
// Indicates whether a column's case matters
// in the designated column.
System.out.println(rsMetaData.isCaseSensitive(i));
// Indicates whether a column's case matters
// in the designated column.
System.out.println(rsMetaData.isSearchable(i));
// indicates whether values in the designated
// column are signed numbers.
System.out.println(rsMetaData.isSigned(i));
// Gets the designated column's table's catalog name.
System.out.println(rsMetaData.getCatalogName(i));
// Gets the designated column's table's schema name.
System.out.println(rsMetaData.getSchemaName(i));
st.close();
conn.close();
public static Connection getOracleConnection() throws Exception {
String driver = "oracle.jdbc.driver.OracleDriver";
String url = "jdbc:oracle:thin:@son15644:1521:CXPqa1";
String username = "ess4qa2";
String password = "ess4qa2pw";
Class.forName(driver); // load Oracle driver
Connection conn = DriverManager.getConnection(url, username, password);
return conn;
}
Similar Messages
-
How to get internal table from SAP Data Provider C#
Hello.
ABAP:
DATA: lt_t001 TYPE TABLE OF t001.
DATA: url(1000) TYPE c.
SELECT * INTO TABLE lt_t001 FROM t001.
CALL FUNCTION 'DP_CREATE_URL'
EXPORTING
type = 'APPLICATION'
subtype = 'X-R3TABLE'
TABLES
data = lt_t001
CHANGING
url = url
EXCEPTIONS
OTHERS = 4.
C#:
using SAPDataProvider;
using SAPTableFactoryCtrl;
public void SetDataFromUrl(string url)
SAPDataProviderClass p = new SAPDataProviderClass();
p.SetDataFromURL("APPLICATION", "X-R3TABLE", url);
ISapDPR3Table tbl = p.GetDataAsR3Table("APPLICATION", "X-R3TABLE");
SAPTableFactoryClass tf = new SAPTableFactoryClass();
Table tb = (Table)tf.NewTable();
tb.ISAPrfcITab = tbl.DataTable; // Exception !!!!!!
How to get internal table from SAP Data Provider ?Hi Sergey,
I'm trying to do the same, have you found a solution to solved it?
thanks for your help.
Regards.
Jonathan -
How to get pivot table by using dates
Hi,
How to get pivot table by using dates in column.
Below is the sample table and its value is given.
create table sample1
Order_DATE DATE,
order_CODE NUMBER,
Order_COUNT NUMBER
Insert into sample1 (Order_DATE,order_CODE,Order_COUNT) values (to_timestamp('30-SEP-12','DD-MON-RR HH.MI.SSXFF AM'),1,232);
Insert into sample1 (Order_DATE,order_CODE,Order_COUNT) values (to_timestamp('30-SEP-12','DD-MON-RR HH.MI.SSXFF AM'),2,935);
Insert into sample1 (Order_DATE,order_CODE,Order_COUNT) values (to_timestamp('30-SEP-12','DD-MON-RR HH.MI.SSXFF AM'),3,43);
Insert into sample1 (Order_DATE,order_CODE,Order_COUNT) values (to_timestamp('30-SEP-12','DD-MON-RR HH.MI.SSXFF AM'),4,5713);
Insert into sample1 (Order_DATE,order_CODE,Order_COUNT) values (to_timestamp('30-SEP-12','DD-MON-RR HH.MI.SSXFF AM'),5,11346);
Insert into sample1 (Order_DATE,order_CODE,Order_COUNT) values (to_timestamp('29-SEP-12','DD-MON-RR HH.MI.SSXFF AM'),1,368);
Insert into sample1 (Order_DATE,order_CODE,Order_COUNT) values (to_timestamp('29-SEP-12','DD-MON-RR HH.MI.SSXFF AM'),2,1380);
Insert into sample1 (Order_DATE,order_CODE,Order_COUNT) values (to_timestamp('29-SEP-12','DD-MON-RR HH.MI.SSXFF AM'),3,133);
Insert into sample1 (Order_DATE,order_CODE,Order_COUNT) values (to_timestamp('29-SEP-12','DD-MON-RR HH.MI.SSXFF AM'),4,7109);
Insert into sample1 (Order_DATE,order_CODE,Order_COUNT) values (to_timestamp('29-SEP-12','DD-MON-RR HH.MI.SSXFF AM'),5,14336);
select * from sample1;So how to get the data like below.
order_date
order_code 30-sep-12 29-sep-12
1 232 368
2 935 1380
3 43 133
4 5713 7109
5 11345 14336Using the extra data I inserted in my previous reply:select ORDER_CODE,
SUM(DECODE(extract (month from ORDER_DATE),1,ORDER_COUNT,0)) JAN,
SUM(DECODE(extract (month from ORDER_DATE),2,ORDER_COUNT,0)) FEB,
SUM(DECODE(extract (month from ORDER_DATE),3,ORDER_COUNT,0)) MAR,
SUM(DECODE(extract (month from ORDER_DATE),4,ORDER_COUNT,0)) APR,
SUM(DECODE(extract (month from ORDER_DATE),5,ORDER_COUNT,0)) MAY,
SUM(DECODE(extract (month from ORDER_DATE),6,ORDER_COUNT,0)) JUN,
SUM(DECODE(extract (month from ORDER_DATE),7,ORDER_COUNT,0)) JUL,
SUM(DECODE(extract (month from ORDER_DATE),8,ORDER_COUNT,0)) AUG,
SUM(DECODE(extract (month from ORDER_DATE),9,ORDER_COUNT,0)) SEP,
SUM(DECODE(extract (month from ORDER_DATE),10,ORDER_COUNT,0)) OCT,
SUM(DECODE(extract (month from ORDER_DATE),11,ORDER_COUNT,0)) NOV,
SUM(DECODE(extract (month from ORDER_DATE),12,ORDER_COUNT,0)) DEC
from SAMPLE1
where trunc(order_date, 'YY') = trunc(sysdate, 'YY')
group by order_code
order by order_code;
ORDER_CODE JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC
1 0 0 0 0 0 0 0 0 600 600 0 0
2 0 0 0 0 0 0 0 0 2315 2315 0 0
3 0 0 0 0 0 0 0 0 176 176 0 0
4 0 0 0 0 0 0 0 0 12822 12822 0 0
5 0 0 0 0 0 0 0 0 25682 25682 0 0Now a bit of explanation.
1) Whenever you pivot rows to columns, no matter what version of Oracle and no matter what method you use, you have to decide in advance how many columns you are going to have and what the names of the columns are. This is a requirement of the SQL standard.
2) I use the WHERE clause to get just the data for this year
3) With EXTRACT, I get just the month without the year.
4) Using DECODE, I put every month's data into the correct column
5) Once I do all that, I can just GROUP BY order_code while SUMming all the data for each month. -
How to get the table of value field? and can we expand the technical limits
Dear
I have created value field in COPA with KEA6. And now, I need the table which the value fields are saved. Yet, I have tried a lot to find it and get failure? Can any guy help me? Please tell me how to get the table of a value field.
And another question is that, can we extend the technical limits for the number of value field for ECC6.0?
We have a note for R.4.x Please see below:
OSS note 160892
You can display the length of a data record using Transaction KEA0 ('Maintain Operating Concern'). After you have navigated to the 'Characteristics Screen' or to the 'Value field Screen' choose menu path 'Extras -> Technical Limits'.
The maximum displayed here under 'Length in bytes on the DB' is the maximum length permitted by the Dictionary. The reserve required for the release upgrade must be subtracted from this value.
To increase the allowed number of the value fields, increase the value that is assigned to field ikcge-bas_max_cnt (FORM init_ikcge_ke USING fm_subrc, approx. line 165) in Include FKCGNF20. It specifies the number of the possible value fields. The corresponding part of the source code is attached to the note as a correction.
David Sun
Regards!how to extend the limit of value numbers? please see the original question.
-
How-To "Refresh a table of data after inserting or deleting"
I'd like to say a word on the how-to article "How to refresh a table of data after inserting or deleting a row using ADF".
(http://www.oracle.com/technology/products/jdev/howtos/1013/updtable/index.html?_template=/ocom/technology/content/print)
I spent a lot of time on it because I needed help in implementing simple CRUD functionality on a table, using JSF-ADF-TopLink technologies.
While the the article does provide correct steps, it is in one important place not specific enough, so the reader may easily get stuck. In section "Refresh the data table", point 1: when you double click on the removeEntity() button, in Structure window, then you do not get the required dialog. You get CommandButton Properties dialog.
You must click on the removeEntity() button in Editor's Design view. But even there you may get the CommandButton Properties dialog, not managed beans dialog.
You may resolve that by going to JSF configuration file, faces-config.xml, and switch to Overview view. This will show you the managed beans that you have.
Then, you may already have a backing bean for the page. You can use that and avoid creating a new managed bean.
I could understand what the operations mean only after very careful reading of "Creating More Complex Pages", section "Overriding Declarative Methods" in JDeveloper Help (or in ADF Developer's Guide PDF document).
In general: I believe that "ADF bindings" need more conceptual explanation, maybe in form of an article. Grammatical form "bindings" may create a false understanding that "bindings" are just references. But they are not -- ADF bindings are active objects that handle traffic between UI components and Data Controls. It seems that "bindings" even communicate among themselves. Maybe it would be more understandable to differentiate strictly between "binding objects" (or "binders"?), binding object definitions and binding object references.
It would be very helpful to have a diagram showing grahically what specific binder objects are created in a small apllication (2-3 pages using 1-2 tables), with whom they communicate and what type of data is passed on.
PriitHi
Thanks for your infos.
Yes exactly I use almost the same code you have post here.
Could You answer to my next questions?
First - >what do you mean by saying that "it's not good idea using refreshing in IE?" Of course I use refreshing in backing_bean for my button "remove" that removes row, commit changes to database and refresh table, almost the same as You said in your post:
Code in backing_bean is and comments on difference to Your code is below:
public commandButton2_action1(){
BindingContainer bindings = getBindings();
OperationBinding operationBinding =
bindings.getOperationBinding("removeEntity");
Object result = operationBinding.execute();
if (!operationBinding.getErrors().isEmpty()) {
return null;
//above remove entity, but I dont now if it do commit to database? So i do it below
OperationBinding commit1 = bindings.getOperationBinding("Commit");
commit1.execute();
//and at the end I refresh my table, "findAllRezerwacja1 - it is an id of the methodAction, not the iterator -> is it ok? or should I change to Iterator id?
OperationBinding requery = bindings.getOperationBinding("findAllRezerwacja1");
requery.execute();
return null;
Page Definition code for this:
<methodAction id="findAllRezerwacja1"
InstanceName="SessionEJBLocal.dataProvider"
DataControl="SessionEJBLocal" MethodName="findAllRezerwacja"
RequiresUpdateModel="true" Action="999"
ReturnName="SessionEJBLocal.methodResults.SessionEJBLocal_dataProvider_findAllRezerwacja_result"/>
<table id="findAllRezerwacja2" IterBinding="findAllRezerwacja1Iter">
<AttrNames>
<Item Value="dataDo"/>
<Item Value="dataOd"/>
<Item Value="idRezerwacja"/>
<Item Value="liczbaUczestnikow"/>
<Item Value="prowadzacy"/>
<Item Value="uwagi"/>
</AttrNames>
</table>
<methodAction id="removeEntity" InstanceName="SessionEJBLocal.dataProvider"
DataControl="SessionEJBLocal" MethodName="removeEntity"
RequiresUpdateModel="true" Action="999">
<NamedData NDName="entity"
NDValue="${bindings.findAllRezerwacja2.currentRow.dataProvider}"
NDType="java.lang.Object"/>
</methodAction>
<action id="Commit" IterBinding="findAllRezerwacja1Iter"
InstanceName="SessionEJBLocal.dataProvider"
DataControl="SessionEJBLocal" RequiresUpdateModel="true"
Action="2"/>
</bindings>
//and rest of code for Iterator etc
My second question is, why when you use refresh button in IE (I know is not recommended as You said, but sometimes user do it, so I want prevent situations that I will describe here) so when I press refresh button in IE exactly after removing one row by clicking my button, refreshing by pressing IE button is doing the same --> is deleting next row. How to stop deleting row, when for example user would press IE refresh button after pressing remove button for table. If I change selection in table after deleting row, and press refresh button in IE, instead of deleting row, I got error message: JBO-29000: JBO-35007: and
JBO-35007. So where Im doing wrong. Maybe I should do sth with postback ? Could You help me? Thanks in advance
Last one question: what is the difference between using delete and removeEntity from operations node? Im now reading carefully ADF Dev Guide, so I hope I can find infos there? But if You know, please answer to this question.
Thanks -
How to get length of a data field
Hi Experts,
How to get length of a data field. For example data field /BIC/0COSTCENTER length is 9. and the entry in the table is /BIC/0COSTCENTER = 1000 only. How to get the lenth of value in the table.
Any help greatly appreciated. Thanks.
Best Regards,
Suresh.Below is example code
Data: var1(10) type c value '2500',
var2 type i.
var2 = Strlen( var1 ).
write var2.
<b>Reward Points for helpful answers</b>
Satish -
How to get the table with no. of records after filter in webdynpro
Dear Gurus,
How to get the table with no. of records after filter in webdynpro?
Thanks in advance.
SankarHello Sankar,
Please explain your requirement clearly so that we can help you easily.
To get the table records from your context node use method get_static_attributes_table()
data lo_nd_mynode type ref to if_wd_context_node.
data lt_atrributes_table type wd_this->elements_mynode.
lo_nd_mynode = wd_context->get_child_node( name = wd_this->wdctx_mynode ).
lo_nd_mynode->get_static_attributes_table( importing table = lt_atrributes_table ).
Note: You should have already defined your context node as a Dictionary Structure.
BR,
RAM -
How to get updated table values from objectlistdataproviders
how to get updated table values from objectlistdataproviders
Hi,
Here is a sample code
start-of-selection.
*Select the data you need into an internal table
loop at it_mara into wa_mara.
data that needs to be displayed in the output list
write:/ box as checkbox,
wa_mara-matnr under text-001,
wa_mara-maktx under text-002,
wa_mara-lgort under text-003.
Hide the data that needs to moved to internal table
hide:wa_mara-matnr, wa_mara-maktx, wa_mara-lgort.
endloop.
clear wa_mara.
end-of-selection.
lines = sy-linno.
at line-selection.
clear:it_matnr.
do lines times.
check sy-index > 1.
box = space.
read line sy-index field value box.
if box = 'X'.
*data selected using check box is moved to internal table
append wa_mara to it_matnr.
endif.
enddo.
Regards,
Jisha. -
How to get an email when data got inserted
Hi All,
Could you please let me know how to get an email when data got inserted into table by using sql/plsql
Thanks in adavanceCould you please let me know how to get an email when data got inserted into table by using sql/plsql
Well that seems pretty straightforward - write some pl/sql to send you an email when that pl/sql inserts data into a table.
See this Oracle-base article for an example of sending mail.
http://www.oracle-base.com/articles/misc/email-from-oracle-plsql.php
Post what you have tried so far. What part of what you have tried doesn't seem to be working? -
How to get the user entered data?
Hi all,
I have created an HTMLB DynPage component.
In That i have created my input screen with textboxes using response.write method.
i have added one onConfirm event on which the data whould validate.
so onConfirm method im trying to get the data with request.getParameter method which returns null...
how to do...how to get the user entered data to do my validations...can anyone plz advice.
Thanks,
ViswesHi
inputfield or textbox component entered directly using response.write(...) are not htmlb , but html.
to create portal input field (ie HTMLB), you should do something like
this in the doProcessBeforeOutput member function
InputField field1 = new InputField("Id1");
field1.setSize(8); // 8 characters
this.getForm().addComponent(field1);
and in doProcessAfterInput member function
InputField field1 =
(InputField) this.getComponentByName("Id1");
you can then manipulate the content of the field.
Hope this help,
Guillaume -
How to get ArrayCollection's total data after filter
after i use filterFunction to filter data of some
ArrayCollection. so how to get the total original data of this
ArrayCollection?
NOT use filterFunction = null, because i use the filter data
to show at the same time!
thank you!You can get the underlying array by accessing the
ArrayCollection's "source". -
How to fetch the Table Control data to Customer Table(Z-Table) ?
How to fetch the Table Control data to Customer Table(Z-Table) ?
Hi Krishna,
Check this sample programs
http://www.planetsap.com/online_pgm_main_page.htm
http://sap.niraj.tripod.com/id29.html
http://www.sapdevelopment.co.uk/dialog/tabcontrol/tc_basic.htm
Have a look at below links. It will help you.
http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbac5135c111d1829f0000e829fbfe/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbac1d35c111d1829f0000e829fbfe/content.htm
Thanks,
Reward If helpful. -
How can get difference between 2 dates in the form of days
how can get difference between 2 dates in the form of days
Hi,
Check the following program:
REPORT ZDATEDIFF.
DATA: EDAYS LIKE VTBBEWE-ATAGE,
EMONTHS LIKE VTBBEWE-ATAGE,
EYEARS LIKE VTBBEWE-ATAGE.
PARAMETERS: FROMDATE LIKE VTBBEWE-DBERVON,
TODATE LIKE VTBBEWE-DBERBIS DEFAULT SY-DATUM.
call function 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
exporting
i_date_from = FROMDATE
i_date_to = TODATE
I_FLG_SEPARATE = ' '
IMPORTING
E_DAYS = EDAYS
E_MONTHS = EMONTHS
E_YEARS = EYEARS.
WRITE:/ 'Difference in Days ', EDAYS.
WRITE:/ 'Difference in Months ', EMONTHS.
WRITE:/ 'Difference in Years ', EYEARS.
INITIALIZATION.
FROMDATE = SY-DATUM - 60.
Regards,
Bhaskar -
How to get current time and date??
How to get current time and date from my PC time and date to the java application??
i use java.util.* package but got error, that is:
- java.util.* and java.sql.* class are match
- abstract class cannot be instantiated
so what can i do, pls guide...thanks...There is a method in the System class that will return the current system time. You could also instantiate a Date, Time, Timestamp, or Calendar object, all of which get created with the system time by default.
Don't import *. Import the specific classes you need.
Next time, post the actual text of the exceptions/compile errors. If you make people guess, most just won't bother. -
How to get group when the data source from system instead of UME database
Hig guys,
How to get group when the data source comes from backend system instead of UME database?
I tried to use
IUMPrincipal RefGroup = WPUMFactory.getGroupFactory().getGroup(groupName);
But I was not able to get the group. But in "UserAdministrator", I can find this groupName.
Which kind of API can I use?
Thanks in advance!
Regards,
Liying
Message was edited by:
Liying WangOk,
try this:
com.sapportals.portal.security.usermanagement.IGroupFactory ep5GroupFactory = userManagementService.getGroupFactory();
IGroupFactory groupFactory = UMFactory.getGroupFactory();
com.sap.security.api.IGroup group = groupFactory.getGroupByUniqueName(groupName);
IUMPrincipal ep5Principal = ep5GroupFactory.getEP5Group(group);
This should do the trick,
Romano
PS: and thanks for the stars!
Maybe you are looking for
-
Help! I upgraded my iphone 4 to ios 6 and now one of my two emai accounts - my work account - no longer receives/sends emails. I checked my e-mail settings and they were correct. I then deleted the account and tried to re-add it, per discussions i
-
Ipad no longer 'registered' with my lap top
Hey guys. I recently had to send my lap top away to get repaired.Almost 4 weeks later i got it back...FORMATTED !!!. Now when i try to sync my ipad it tells me that it is no longer registered with this itunes account, when i try to sync i loose every
-
The power light goes on but I get no video. What would be the reason for this and can one do something on their own without having to send it in. It is a 2004 emac and has perfectly fine till all of a sudden I get no video from it.
-
No parameter view when running "Format Payment Instructions" conc prog
Hello everyone. When submitting the Format Payment Instructions program (when making a payment) I am not asked for any parameters. Previously the program would ask for parameters. Does anyone have any idea why this is happening and what to do about i
-
Unable to install solaris 8 & 9 & 10
Hello, This is til from india, i was purchased one system which is sun supporters given to on chat. That model is ASUS motherboard (M2A-VM) i was selceted this model from (http://www.sun.com/bigadmin/hcl/data/sol/systems/views/all_motherboards_all_re