Add records to table T180a
Godd morning
I'm not able di add records at table T180a.
I'm not do "append t180a".
tables: T180A.
DATA:lw_file type string. " File Path
DATA: BEGIN OF t_itab OCCURS 0.
INCLUDE STRUCTURE T180A.
data: end of t_itab .
lw_file = 'X:\Dokumente und Einstellungen\users\Desktop\t180a.TXT'.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = lw_file
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
tables
data_tab = t_itab
loop at t_itab.
move-corresponding t_itab to T180a.
endloop.
leave program.
Do you have any idea what you are trying to do here? Looking at your code, I don't think you do since it's really bad!!! Sorry, but there is no other way to put this.
What gave you the idea that table T180a would be updated using MOVE-CORRESPONDING??
Similar Messages
-
Add records in table ACCESS from labview by ActiveX
I try to add records in table of database ACCESS by an ActiveX from labview but my programme doesn't work ...
What is the problem ?
I have attached my VI
Thanks in advance
hasna
Attachments:
base1.vi 35 KBOn Thu, 11 Jul 2002 08:13:48 -0700 (PDT), Lab Viewer
wrote:
>I saw your previous posts related to ActiveX/Access. I once had the
>same kind of problems. It's not an easy task (without a toolkit)
>because you have to learn the "interface" provided by Access/DAO in
>order to manage what you are trying to do.
>In my case, the best solution it was to follow the Visual Basic for
>Applications examples included in MS Access. Even though you don't
>know VB, don't be afraid. Important is to figure out from that example
>what methods/properties you need to use, the proper order to call them
>and eventually some parameters. You are dealing with the same
>methods/properties in LabVIEW, the difference is that you have them in
>a graphical format instead of text
.You can find these examples by
>going to MS Access help > Index and type DAO objects and then choose
>one to start with (Database, recordset, field =85).
>
>Hope this helps
The examples on NI's website were originally written using the DAO
model, but the latest one was written using the ADO model.
However, I am unable to find either example LLBs on their website
anymore. Maybe they're trying to push their SQL Toolkit.
Along with the VBA help in MS Access, I *highly* recommend the book
ADO Programming for Dummies. Wonderful book. Helped me understand the
VBA help. :-)
Again, if anyone is intersted in VIs using ActiveX that works. He/she
is welcome to email me.
Linda -
Is it possible to add records to tables using Enterprise Manager?
Can we add records to tables using Oracle Enterprise Manager web interface instead of the sqlplus commands ? if not, is there any easy way to insert data into table using a graphical interface?
You may consider using iSQL*Plus.
Check http://www.oracle.com/technology/obe/obe10gdb/install/isqlplus/isqlplus.htm
Thanks, -
Add a new record to table control
Dear all,
How to add a new blank record to a table control?
Following code is not working for adding a new blank record to a table control
MODULE USER_COMMAND_0100 INPUT.
SAVE_OK = OK_CODE.
CLEAR OK_CODE.
CASE SAVE_OK.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'APND'. " A button "Add" to add a new record to table control
REFRESH IT_KNA1.
CLEAR IT_KNA1.
APPEND IT_KNA1.
ENDCASE.
ENDMODULE.
Thanks youHope you have done all table control specific coding
refer this example program
http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbac5e35c111d1829f0000e829fbfe/content.htm -
Asset related question - How to add a record into table ANLC?
Hello experts,
Could anyone tell me how to add a record into table ANLC?
Thanks very much!
Christina.how you want add?
you want add direct in table???.
Normally if yo post any transaction this table will update.
ex;acquisition;
chandra -
Hai,
I want to add records to the UDO table through vb.net coding. How to achieve it?
Thanks in advance!!!Please check the GeneralService Object in the SDK help file. For example:
Dim oGeneralService As SAPbobsCOM.GeneralService
Dim oGeneralData As SAPbobsCOM.GeneralData
Dim oChild As SAPbobsCOM.GeneralData
Dim oChildren As SAPbobsCOM.GeneralDataCollection
Dim oGeneralParams As SAPbobsCOM.GeneralDataParams
'Get GeneralService (oCmpSrv is the CompanyService)
Set oGeneralService = oCmpSrv.GetGeneralService("MainUDO")
'Create data for new row in main UDO
Set oGeneralData = oGeneralService.GetDataInterface(gsGeneralData)
oGeneralData.SetProperty "Code", "First"
oGeneralData.SetProperty "U_Data", "my data"
'Create data for a row in the child table
Set oChildren = oGeneralData.Child("ChildUDO")
Set oChild = oChildren.Add
oChild.SetProperty "U_Data", "child data"
oChild.SetProperty "U_Type", 6
'Add the new row, including children, to database
oGeneralService.Add oGeneralData
See the documentation for the GeneralService methods Add, Cancel, Close, Delete, GetByParams, GetDataInterfaceFromXMLFile, GetDataInterfaceFromXMLString, GetList, InvokeMethod and Update for more code samples -
Hi frnds,
I have a problem in account application of our PCUI portal.
In PCUI we personalize the fields that are returned in the search functionality by clicking the "Personalize" Tab under Accounts.
In our case one of the user is getting differrent optons in the personalize popup than other , i debugged the class "CL_CRM_BSP_LIST_PERS" and found that the column list is comming from table "CRMD_PERS_LIST".
If there is no records present in this table for a pirticular user it is picking form table "CRMC_LISTCOLC.
The records from these table are fetched using the user name,View & Field group.
Can any body tell me how we can add records in the table "CRMD_PERS_LIST" and "CRMC_LISTCOLC" for pirticular user.
Do we have any kind of customization ( in spro or blueprint) for maintaining data in these tables.
Regards,
Sandipan jenaresolved my self
-
How to add records or how to maintain list in stored Procedure
Hi,
I am facing an issue in the addition of record in the type
create or replace
TYPE "PROD_SEARCH_COUNT_TBL" AS TABLE OF PROD_SEARCH_COUNT_OBJ;
create or replace
TYPE "PROD_SEARCH_COUNT_OBJ" AS OBJECT
( /* TODO enter attribute and method declarations here */
V_Name Varchar2(500 Byte),
v_Value Varchar2(500 Byte),
v_count Number
I want to add records to the type I tried following way
prod_wcf_rec PROD_SEARCH_COUNT_TBL;
SELECT PROD_SEARCH_COUNT_OBJ('Name1','Value1',1) BULK COLLECT INTO prod_wcf_rec FROM DUAL;
SELECT PROD_SEARCH_COUNT_OBJ('Name2','Value2',2) BULK COLLECT INTO prod_wcf_rec FROM DUAL;
SELECT PROD_SEARCH_COUNT_OBJ('Name3','Value3',3) BULK COLLECT INTO prod_wcf_rec FROM DUAL;
SELECT PROD_SEARCH_COUNT_OBJ('Name4','Value4',4) BULK COLLECT INTO PROD_WCF_REC FROM DUAL;
DBMS_OUTPUT.PUT_LINE ('-----------------------------Looping----------------------------');
FOR i in 1 .. prod_wcf_rec.COUNT
LOOP
DBMS_OUTPUT.PUT_LINE (prod_wcf_rec(i).V_Name||' - '||prod_wcf_rec(i).v_Value||' - '||prod_wcf_rec(i).v_count);
END LOOP;
DBMS_OUTPUT.PUT_LINE ('-----------------------------Looping----------------------------');
In printing I am getting last records only .So is there any way to add records to PROD_SEARCH_COUNT_TBL
How to add records or how to maintain list in stored ProcedureEvery time you BULK COLLECT into a collection type the value is overwirtten. So you need to try something like this.
SQL> create or replace type prod_search_count_obj as object(v_name varchar2(500 byte), v_value varchar2(500 byte), v_count number)
2 /
Type created.
SQL> create or replace type prod_search_count_tbl as table of prod_search_count_obj
2 /
Type created.
SQL> declare
2 prod_wcf_rec prod_search_count_tbl;
3 begin
4 select obj_val
5 bulk collect into prod_wcf_rec
6 from (
7 select prod_search_count_obj('name1','value1',1) obj_val from dual
8 union all
9 select prod_search_count_obj('name2','value2',2) from dual
10 union all
11 select prod_search_count_obj('name3','value3',3) from dual
12 union all
13 select prod_search_count_obj('name4','value4',4) from dual
14 );
15
16 dbms_output.put_line ('-----------------------------looping----------------------------');
17 for i in 1 .. prod_wcf_rec.count
18 loop
19 dbms_output.put_line (prod_wcf_rec(i).v_name||' - '||prod_wcf_rec(i).v_value||' - '||prod_wcf_rec(i).v_count);
20 end loop;
21 dbms_output.put_line ('-----------------------------looping----------------------------');
22 end;
23 /
-----------------------------looping----------------------------
name1 - value1 - 1
name2 - value2 - 2
name3 - value3 - 3
name4 - value4 - 4
-----------------------------looping----------------------------
PL/SQL procedure successfully completed.
SQL> -
Function module to add record into incompletion log of creating sale order
Hi SD Experts,
Do you know any function module / class to add record a into incompletion log procedure of creating / changing sale order process? We can do it through configuration OVA2 but I need to add more condition before adding to this table.
Thanks,
DuyHi,
Refer to The SDN Post : [user exit to update the incompletion log in sales order for pricing error |Re: user exit to update the incompletion log in sales order for pricing error].
Limitation : While creating Sales order, this works only for document type with external number range as the code required for updating XVBUV require Sales Order Number.
Regards
Vinod -
How to insert a new record to table with foreign key
I have 3 tables like this :
CREATE TABLE PERSON (
PK INTEGER NOT NULL,
NAME VARCHAR(10),
SSNUM INTEGER,
MGR INTEGER);
ALTER TABLE PERSON ADD CONSTRAINT PK_PERSON PRIMARY KEY (PK);
ALTER TABLE PERSON ADD CONSTRAINT FK_PERSON FOREIGN KEY (MGR) REFERENCES
PERSON (PK);
/* Tables
CREATE TABLE PROJECT (
PK INTEGER NOT NULL,
CODE_NAME INTEGER);
ALTER TABLE PROJECT ADD CONSTRAINT PK_PROJECT PRIMARY KEY (PK);
/* Tables
CREATE TABLE XREF (
PERSON INTEGER NOT NULL,
PROJECT INTEGER NOT NULL);
ALTER TABLE XREF ADD CONSTRAINT PK_XREF PRIMARY KEY (PERSON, PROJECT);
ALTER TABLE XREF ADD CONSTRAINT FK_XREF1 FOREIGN KEY (PERSON) REFERENCES
PERSON (PK);
ALTER TABLE XREF ADD CONSTRAINT FK_XREF2 FOREIGN KEY (PROJECT) REFERENCES
PROJECT (PK);
I do like the way of "ReverseTutoral" and the file .jdo here :
<?xml version="1.0" encoding="UTF-8"?>
<jdo>
<package name="reversetutorial">
<class name="Person" objectid-class="PersonId">
<extension vendor-name="kodo" key="class-column" value="none"/>
<extension vendor-name="kodo" key="lock-column" value="none"/>
<extension vendor-name="kodo" key="table" value="PERSON"/>
<field name="name">
<extension vendor-name="kodo" key="data-column"
value="NAME"/>
</field>
<field name="person">
<extension vendor-name="kodo" key="pk-data-column"
value="MGR"/>
</field>
<field name="persons">
<collection element-type="Person"/>
<extension vendor-name="kodo" key="inverse"
value="person"/>
<extension vendor-name="kodo" key="inverse-owner"
value="person"/>
</field>
<field name="pk" primary-key="true">
<extension vendor-name="kodo" key="data-column"
value="PK"/>
</field>
<field name="ssnum">
<extension vendor-name="kodo" key="data-column"
value="SSNUM"/>
</field>
<field name="xrefs">
<collection element-type="Xref"/>
<extension vendor-name="kodo" key="inverse"
value="person"/>
<extension vendor-name="kodo" key="inverse-owner"
value="person"/>
</field>
</class>
<class name="Project" objectid-class="ProjectId">
<extension vendor-name="kodo" key="class-column" value="none"/>
<extension vendor-name="kodo" key="lock-column" value="none"/>
<extension vendor-name="kodo" key="table" value="PROJECT"/>
<field name="codeName">
<extension vendor-name="kodo" key="data-column"
value="CODE_NAME"/>
</field>
<field name="pk" primary-key="true">
<extension vendor-name="kodo" key="data-column"
value="PK"/>
</field>
<field name="xrefs">
<collection element-type="Xref"/>
<extension vendor-name="kodo" key="inverse"
value="project"/>
<extension vendor-name="kodo" key="inverse-owner"
value="project"/>
</field>
</class>
<class name="Xref" objectid-class="XrefId">
<extension vendor-name="kodo" key="class-column" value="none"/>
<extension vendor-name="kodo" key="lock-column" value="none"/>
<extension vendor-name="kodo" key="table" value="XREF"/>
<field name="person">
<extension vendor-name="kodo" key="pk-data-column"
value="PERSON"/>
</field>
<field name="person2" primary-key="true">
<extension vendor-name="kodo" key="data-column"
value="PERSON"/>
</field>
<field name="project">
<extension vendor-name="kodo" key="pk-data-column"
value="PROJECT"/>
</field>
<field name="project2" primary-key="true">
<extension vendor-name="kodo" key="data-column"
value="PROJECT"/>
</field>
</class>
</package>
</jdo>
Data of those tables are :
PERSON :
| PK | NAME | SSNUM | MGR |
| 1 | ABC | 1 | 1 |
| 2 | DEF | 5 | 1 |
PROJECT
| PK | CODE_NAME |
| 1 | 12 |
| 2 | 13 |
And now I want to add a new record into table XREF : insert into XREF
values (1,1);
public void createData() {
Xref xref = new Xref();
Person person = new Person(1);
Project project = new Project(1);
xref.setPerson(person);
xref.setProject(project);
person.getXrefs().add(xref);
person.getXrefs().add(xref);
pm.currentTransaction().begin();
pm.makePersistent(xref);
pm.currentTransaction().commit();
I don't know why Kodo automatically insert new record to table PERSON ->
confilct Primary Key. The errors are :
0 [main] INFO kodo.Runtime - Starting Kodo JDO version 2.4.1
(kodojdo-2.4.1-20030126-1556) with capabilities: [Enterprise Edition
Features, Standard Edition Features, Lite Edition Features, Evaluation
License, Query Extensions, Datacache Plug-in, Statement Batching, Global
Transactions, Developer Tools, Custom Database Dictionaries, Enterprise
Databases, Custom ClassMappings, Custom ResultObjectProviders]
41 [main] WARN kodo.Runtime - WARNING: Kodo JDO Evaluation expires in 29
days. Please contact [email protected] for information on extending
your evaluation period or purchasing a license.
1627 [main] INFO kodo.MetaData -
com.solarmetric.kodo.meta.JDOMetaDataParser@e28b9: parsing source:
file:/D:/AN/Test/classes/reversetutorial/reversetutorial.jdo
3092 [main] INFO jdbc.JDBC - [ C:23387093; T:19356985; D:10268916 ] open:
jdbc:firebirdsql:localhost/3050:D:/An/test/temp.gdb (sysdba)
3325 [main] INFO jdbc.JDBC - [ C:23387093; T:19356985; D:10268916 ]
close:
com.solarmetric.datasource.PoolConnection@164dbd5[[requests=0;size=0;max=70;hits=0;created=0;redundant=0;overflow=0;new=0;leaked=0;unavailable=0]]
3335 [main] INFO jdbc.JDBC - [ C:23387093; T:19356985; D:10268916 ] close
connection
3648 [main] INFO jdbc.JDBC - Using dictionary class
"com.solarmetric.kodo.impl.jdbc.schema.dict.InterbaseDictionary" to
connect to "Firebird" (version "__WI-V6.2.972 Firebird 1.0.3)WI-V6.2.972
Firebird 1.0.3/tcp (annm)/P10") with JDBC driver "firebirdsql jca/jdbc
resource adapter" (version "0.1")
4032 [main] INFO jdbc.JDBC - [ C:25657668; T:19356985; D:10268916 ] open:
jdbc:firebirdsql:localhost/3050:D:/An/test/temp.gdb (sysdba)
4143 [main] INFO jdbc.SQL - [ C:25657668; T:19356985; D:10268916 ]
preparing statement <3098834>: INSERT INTO XREF(PERSON, PROJECT) VALUES
4224 [main] INFO jdbc.SQL - [ C:25657668; T:19356985; D:10268916 ]
executing statement <3098834>: [reused=1;params={(int)1,(int)1}]
4244 [main] INFO jdbc.SQL - [ C:25657668; T:19356985; D:10268916 ]
preparing statement <9090824>: INSERT INTO PERSON(MGR, NAME, PK, SSNUM)
VALUES (?, ?, ?, ?)
4315 [main] INFO jdbc.SQL - [ C:25657668; T:19356985; D:10268916 ]
executing statement <9090824>: [reused=1;params={null,null,(int)1,(int)0}]
4598 [main] WARN jdbc.JDBC - java.sql.SQLWarning: java.sql.SQLWarning:
resultSetType or resultSetConcurrency changed
4598 [main] WARN jdbc.JDBC - java.sql.SQLWarning: java.sql.SQLWarning:
resultSetType or resultSetConcurrency changed
4598 [main] INFO jdbc.JDBC - [ C:25657668; T:19356985; D:10268916 ] begin
rollback
4608 [main] INFO jdbc.JDBC - [ C:25657668; T:19356985; D:10268916 ] end
rollback 10ms
4628 [main] INFO jdbc.JDBC - [ C:25657668; T:19356985; D:10268916 ]
close:
com.solarmetric.datasource.PoolConnection@1878144[[requests=2;size=2;max=70;hits=0;created=2;redundant=0;overflow=0;new=2;leaked=0;unavailable=0]]
4628 [main] INFO jdbc.JDBC - [ C:25657668; T:19356985; D:10268916 ] close
connection
javax.jdo.JDOFatalDataStoreException:
com.solarmetric.kodo.impl.jdbc.sql.SQLExceptionWrapper:
[SQL=INSERT INTO PERSON(MGR, NAME, PK, SSNUM) VALUES (null, null, 1, 0)]
[PRE=INSERT INTO PERSON(MGR, NAME, PK, SSNUM) VALUES (?, ?, ?, ?)]
GDS Exception. violation of PRIMARY or UNIQUE KEY constraint "PK_PERSON"
on table "PERSON" [code=335544665;state=null]
NestedThrowables:
com.solarmetric.kodo.impl.jdbc.sql.SQLExceptionWrapper:
[SQL=INSERT INTO PERSON(MGR, NAME, PK, SSNUM) VALUES (null, null, 1, 0)]
[PRE=INSERT INTO PERSON(MGR, NAME, PK, SSNUM) VALUES (?, ?, ?, ?)]
GDS Exception. violation of PRIMARY or UNIQUE KEY constraint "PK_PERSON"
on table "PERSON"
at
com.solarmetric.kodo.impl.jdbc.runtime.SQLExceptions.throwFatal(SQLExceptions.java:17)
at
com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.flush(JDBCStoreManager.java:416)
at
com.solarmetric.kodo.runtime.PersistenceManagerImpl.flush(PersistenceManagerImpl.java:575)
at
com.solarmetric.kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:438)
at reversetutorial.Finder.createData(Finder.java:74)
at reversetutorial.Finder.main(Finder.java:141)
NestedThrowablesStackTrace:
org.firebirdsql.jdbc.FBSQLException: GDS Exception. violation of PRIMARY
or UNIQUE KEY constraint "PK_PERSON" on table "PERSON"
at
org.firebirdsql.jdbc.FBPreparedStatement.internalExecute(FBPreparedStatement.java:425)
at
org.firebirdsql.jdbc.FBPreparedStatement.executeUpdate(FBPreparedStatement.java:136)
at
com.solarmetric.datasource.PreparedStatementWrapper.executeUpdate(PreparedStatementWrapper.java:111)
at
com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executePreparedStatementNonBatch(SQLExecutionManagerImpl.java:542)
at
com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executePreparedStatement(SQLExecutionManagerImpl.java:511
at
com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executeInternal(SQLExecutionManagerImpl.java:405)
at
com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.flush(SQLExecutionManagerImpl.java:272
at
com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.flush(JDBCStoreManager.java:411)
at
com.solarmetric.kodo.runtime.PersistenceManagerImpl.flush(PersistenceManagerImpl.java:575)
at
com.solarmetric.kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:438)
at reversetutorial.Finder.createData(Finder.java:74)
at reversetutorial.Finder.main(Finder.java:141)
at org.firebirdsql.gds.GDSException: violation of PRIMARY or UNIQUE KEY
constraint "PK_PERSON" on table "PERSON
at org.firebirdsql.jgds.GDS_Impl.readStatusVector(GDS_Impl.java:1683)
at org.firebirdsql.jgds.GDS_Impl.receiveResponse(GDS_Impl.java:1636)
at org.firebirdsql.jgds.GDS_Impl.isc_dsql_execute2(GDS_Impl.java:865)
at
org.firebirdsql.jca.FBManagedConnection.executeStatement(FBManagedConnection.java:782)
at
org.firebirdsql.jdbc.FBConnection.executeStatement(FBConnection.java:1072)
at
org.firebirdsql.jdbc.FBPreparedStatement.internalExecute(FBPreparedStatement.java:420)
at
org.firebirdsql.jdbc.FBPreparedStatement.executeUpdate(FBPreparedStatement.java:136)
at
com.solarmetric.datasource.PreparedStatementWrapper.executeUpdate(PreparedStatementWrapper.java:111)
at
com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executePreparedStatementNonBatch(SQLExecutionManagerImpl.java:542)
at
com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executePreparedStatement(SQLExecutionManagerImpl.java:511)
at
com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executeInternal(SQLExecutionManagerImpl.java:405)
at
com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.flush(SQLExecutionManagerImpl.java:272)
at
com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.flush(JDBCStoreManager.java:411)
at
com.solarmetric.kodo.runtime.PersistenceManagerImpl.flush(PersistenceManagerImpl.java:575)
at
com.solarmetric.kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:438)
at reversetutorial.Finder.createData(Finder.java:74)
at reversetutorial.Finder.main(Finder.java:141)
Exception in thread "main"First off, use the '-primaryKeyOnJoin true' flag when running the reverse
mapping tool so that you can get rid of that useless Xref class and have
a direct relation between Person and Project. See the documentation on
reverse mapping tool options here:
http://www.solarmetric.com/Software/Documentation/latest/docs/ref_guide_pc_reverse.html
But your real problem is that you are creating new objects, assigning
primary key values, and expecting them to represent existing objects.
That's not the way JDO works. If you want to set relations to existing
objects in JDO, you use the PM to look up those objects. If you try to
create new objects, JDO will assume you want to insert new records into
the DB, and you'll get PK conflicts like you see here.
There are several good books out on JDO; if you're just starting out with
it, they might save you a lot of time and help you master JDO quickly. -
Querying wide (multi-record case) table data in oracle 10g
I've got a set of "wide" (multi-record case data format) tables similar to the format described in Oracle's "Oracle Data Mining Concepts" book in chapter 2 (http://download-west.oracle.com/docs/cd/B14117_01/datamine.101/b10698/2data.htm#1010394).
I like the flexibility of this format, especially since it can handle thousands of attributes. But the main problem I have with this format is in determining how to write efficient, complex queries against the data.
I've included some sample data below to demonstrate my problem. I've got two tables, one with people and the other with the attributes and values of age, income, height and weight. If I try to generate a complex query against this data, I seem to either have to rely on multisets and functions, or on a large number of self joins. Neither of which seems to scale well or perform well for large amounts of data. I know I could also add a pipelined TABLE function to filter the data more, but none of these options seem like great solutions. Does anyone have any ideas for a better way to form complex well performing queries against this type of data layout?
For example, with my sample data below I'd like to select everyone whose (income = 2000) or (income = 50000 and weight = 210), but the only way I see of doing this is with a query like the following (which won't take advantage of any indexes on the data):
select * from people_attributes_view
where find_eq_attr(AttributeValue('income',2000),attribute_values) is not null
or (find_eq_attr(AttributeValue('income',50000),attribute_values) is not null
and
find_eq_attr(AttributeValue('weight',210),attribute_values) is not null);
Any help is greatly appreciated.
Thanks.
-- My full example starts here ----------------
-- Create the sample tables and data
create table people (id int, name varchar(30));
create table attributes (id int, attribute varchar(10), value NUMBER);
insert into people values (1,'tom');
insert into people values (2,'jerry');
insert into people values (3,'spike');
commit;
insert into attributes values (1,'age',23);
insert into attributes values (1,'income',1000);
insert into attributes values (1,'height',5);
insert into attributes values (1,'weight',120);
insert into attributes values (2,'age',20);
insert into attributes values (2,'income',2000);
insert into attributes values (3,'age',30);
insert into attributes values (3,'income',50000);
insert into attributes values (3,'weight',210);
commit;
-- Create some types, functions and views for the search
CREATE OR REPLACE TYPE AttributeValue AS OBJECT
(attribute varchar(30),
value NUMBER);
CREATE OR REPLACE TYPE AttributeValues AS TABLE OF AttributeValue;
create or replace function find_eq_attr (val AttributeValue, vals AttributeValues) RETURN AttributeValue IS
begin
for i in vals.FIRST .. vals.LAST
LOOP
if ((val.attribute = vals(i).attribute) and
(val.value = vals(i).value)) then
return vals(i);
end if;
END LOOP;
return null;
end;
create or replace view people_attributes_view as
select p.name, p.id,
cast(multiset(select attribute,value from attributes a where a.id = p.id)
as AttributeValues) attribute_values
from people p;
-- Search for everyone whose (income = 2000) or (income = 50000 and weight = 210)
select * from people_attributes_view
where find_eq_attr(AttributeValue('income',2000),attribute_values) is not null
or (find_eq_attr(AttributeValue('income',50000),attribute_values) is not null
and
find_eq_attr(AttributeValue('weight',210),attribute_values) is not null);I like the flexibility of this format, especially
since it can handle thousands of attributes. But the
main problem I have with this format is in
determining how to write efficient, complex queries
against the data. Can't be done. The flexibility is achieved at the cost of simplicity and performance, it is a trade off.
See this thread for a full discussion on the subject.
http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:10678084117056 -
Hi,
I have a proble in table control where my table control have 3 lines and when i enter three records i can see the records in table control scrren and when i want to add a 4 th line i need to press a BUTTON.when i press the button a new line inserted but i need to scroll to see the fourth record,but my req ments is to see the 4th record in the 3 rd line of the table control and 3 rd will be seen in the 2 nd line of the table control. Is there any good soultions to achieve this.
Thanks,
DeesanthHi Deesanth,
In the PBO of the screen just add code:-
tab_ctrl-lines = tab_ctrl-lines + 10. "tab_ctrl is name of table control
This will insert 10 extra line in the table control.
You can see these empty line when you scroll the vertical scroll bar of the table control.
Hope this solves your problem.
Thanks & Regards,
Tarun Gambhir -
BDC for existing record in table control
Hi,
I have a requirement to change existing records in table control through BDC. Is there any way I can choose the respective record from Table Control through BDC dynamically.
Regards
Akash/J4I/015PER, this transaction is used for adding permits to Operation in WEC. It has list of operations in Table Control. Permit can be added for choosing the operation from table control.
Our custom program is designed to add permits for the operation. So if I have to use the above transaction for adding permits, then first I have to choose the correct operation from the table control and then add permit. -
Save button is saving records to table even if the error is there
Hi All,
I am having the following issue:
Duplicate records are getting saved in database in table.(When I click on Add Category in table I select Compressor from drop down list.Again I click on Add Category and select Compressor from drop down list.After selecting compressor second time I am getting the error on top--Usage category is already selected.Please select another one.After that if I click on save, the duplicate records got saved even though the error is shown on top). The validation for drop down list is in AM .Can someone tell me that even if the error is there why is save working.
Thanks in advance.
Regards,
Amrithi reetesh,
I am having drop down list where I perform the duplicate validation:(check usage category is fire partial action for drop down list)
if ("checkUsageCategory".equals(pageContext.getParameter(EVENT_PARAM)))
String rowReference = pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE);
Serializable[] parameters = { rowReference };
am.invokeMethod("checkUsageCategory", parameters);
AM code:
public void checkUsageCategory(String rowReference)
OARow row = (OARow)findRowByRef(rowReference);
if (row != null)
String usageCategoryCode = (String) row.getAttribute("UsageCategoryCode");
checkDuplicateKeyForusageCategory(usageCategoryCode);
public void checkDuplicateKeyForusageCategory(String usageCategoryCode)
MTHSustainUsageVOImpl vo = getMTHSustainUsageVO();
Row[] rows = vo.getAllRowsInRange();
int rowDuplicated = 0;
for (int i=0; i<rows.length; i++)
if ( usageCategoryCode.compareTo((String)rows.getAttribute("UsageCategoryCode")) == 0)
rowDuplicated = rowDuplicated + 1;
if (rowDuplicated > 1)
throw new OAException("MTH", "MTH_DUPLICATE_USAGE_CATEGORY");
code for save is:
if ( "Save".equals(pageContext.getParameter(EVENT_PARAM)) ) {
am.invokeMethod("save");}
AM code is:
public void save() {
getTransaction().commit();
Can you tell me where should I modify the code to achieve the above functionality.
Regards,,
Amrit -
I am trying to add a record to a db, it shows that I have added 11 records. When I check no records were updated. I am needing a program that will open an access DB and then ADD records to same. I have enclose my program. I am 73 and had must better luck
doing this in VB3. Any help would
Imports System.IO
Imports System.Data.OleDb
Public Class Form1
Dim result As Boolean
Dim count As Integer
Dim con_string As String
Dim con As New OleDbConnection
Dim chart_key As String
Public RDR As OleDb.OleDbDataReader
Public cmd As OleDbCommand
Private CMD1 As OleDb.OleDbDataAdapter
Private CMD1_Builder As OleDb.OleDbCommandBuilder
Private My_Table As New DataTable
Private My_Row As Integer = 0
Dim x_server As Boolean
Dim mymachinename As String
Dim r_count As Integer
Dim w_count As Integer
Dim db_name As String
Dim my_arg As String
Dim xlen As Integer
Dim hshNotes_MK As New Dictionary(Of String, String)
Dim note As String
Dim Chart_ID As String
Dim Description_ID As String
Dim TR_Description As String
Dim Chart_key_name As String
Dim C_miles As Integer
Dim TR_Miles As Integer
Dim TR_combine As String
Dim C_combine As String
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
x_server = Directory.Exists("\\SERVER\Users\Public\") ' check if server directory is up
mymachinename = UCase$(System.Environment.MachineName())
If mymachinename = "SERVER" Then ' main server computer
con_string = "C:\Users\Public\Data Bases\Expense Car.accdb"
ElseIf x_server = True Then ' Not on Server but connected to Server by Network
con_string = "\\SERVER\Users\Public\Data Bases\Expense Car.accdb"
Else ' We must be on laptop
con_string = "C:\Data Bases\Expense Car.accdb"
End If
Call Add_ToDictionary()
Call Write_Chart()
MsgBox("Add Missing key has Completed, Total Records Read " & r_count.ToString & vbCrLf & " New Keys Added " & w_count.ToString & " Press any key to Continue")
End
End Sub
Private Sub Add_ToDictionary() ' Load up Dictionary with TR Data
hshNotes_MK.Clear()
con = New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & con_string)
Try ' Set up structured error handling.
con.Open()
cmd = New OleDbCommand("SELECT * from TR Order by Description_ID, Miles", con)
RDR = cmd.ExecuteReader
Catch ex As Exception ' If error display message
MsgBox("There was an error opening the Database File, Press any key to cancel")
Exit Sub
Finally
' no error set up loop to read this database
End Try
While RDR.Read ' Load the TR Data Base and load array
count = count + 1
r_count = r_count + 1
If Not TypeOf (RDR("Description_ID")) Is DBNull Then
TR_Description = RDR("Description_ID")
TR_Miles = RDR("Miles")
TR_combine = Trim(TR_Description & "\" & TR_Miles.ToString)
Try
hshNotes_MK.Add(TR_Description, TR_combine)
Catch ex As Exception
' do nothing, key already exsist
End Try
End If
End While
RDR.Close()
cmd.Dispose()
con.Close()
con.Dispose()
End Sub
Private Sub Write_Chart() ' Read Chart File and check dictionary for key
con = New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & con_string)
My_Table.Clear()
count = 0
Try ' Set up structured error handling.
CMD1 = New OleDb.OleDbDataAdapter("SELECT * from Chart Order by Chart_ID, C_Miles", con)
CMD1_Builder = New OleDb.OleDbCommandBuilder(CMD1)
CMD1.Fill(My_Table)
Catch ex As Exception ' If error display
MsgBox("There was an error opening the Database File, Press any key to cancel")
Exit Sub
Finally
' no error set up loop to read this database
End Try
For x = 0 To hshNotes_MK.Count - 1
Dim temp As String = hshNotes_MK.Values(x)
Dim parts As String() = temp.Split("\"c).ToArray()
Call write_it(cmd, parts)
Next
con.Close()
con.Dispose()
CMD1.Dispose()
End Sub
Private Sub write_it(ByVal cmd, ByVal parts)
parts(0) = Trim(parts(0))
parts(1) = Trim(parts(1))
Dim new_row As DataRow = My_Table.NewRow()
new_row("Chart_ID") = parts(0)
new_row("C_Miles") = parts(1)
Try
new_row = My_Table.NewRow()
CMD1.Update(My_Table)
CMD1.Fill(My_Table)
'new_row = My_Table.NewRow
w_count = w_count + 1
Catch ex As Exception
' we had already added so do not add
End Try
End Sub
End Class
be appreciated
Charlie SorokaCharlie
Try to abandon your old style (Cobol) style code. We are not anymore living in those days and programming is evaluated.
This means that we declare no identifiers globally (in top of the program) if there is no need for it. The advantage, it becomes easier to see if the right ones are used.
Secondly avoid ostrich code like this. It only hides the errors and even has the change that at a certain moment everything is wound up and shows an unpredictable error on a whatever moment.
Catch ex As Exception
' we had already added so do not add
End Try
Also know that an update of an adapter does a whole table, no rows (and try to avoid names which are misleading for others, command is another class)
There is a change there are concurrency errors and then those will not be done, but you have hided that likewise I already wrote.
Success
Cor
Maybe you are looking for
-
Various E Mail problems: Junk Mail, Log Off, etc
I am having various and frustrating problems that are intermittant. I have two incoming e mail accounts, one is IMAP and one is POP. 1. Junk Mail. After having reset my junk mail settings as advised on this site just a few days ago, I am continuing t
-
Float displays fine in DW but not in browsers
I'm not posting any code at this stage as I realise this may be a very simple question! I have a simple panel with an image and some text floated around it. This displays fine in the Dreamweaver 8 Design view, but in both IE8 and Firefox, the text d
-
Remote Logon with Internet Explorer
Using SAPNW7.0ABAPTrialSP12. I'm trying to logon in a network by using Internet Explorer but every thing fails. Remote and local Gui Logon is Ok and local logon true URL http://localhost:8000/sap/bc/gui/sap/its/webgui?sap-client=000 is Ok. I don't kn
-
HP Laserjet CM2320 MFP driver problem with Outlook 2013
Hi, The problem starts when you want to print from Outlook 2013 ( Office365 flavour ). You can print once. Then Outlook and the printspooler crashes. In the print qu you find pages NA and no kb for the printvolume. Impossible to delete the printjob n
-
sir, i am using bit locker for external drive and it is paused in between , and it is not resume it shows device is not ready. it show format the disk. please tell me how to fix it without formating error code is x80070015