View to combine 2 spatial tables
Hello
We have 2 schemas S1 and S2. S1 contains sppatial features in UTM Zone 40 projection system and S2 contain feature classes in UTM Zone 39 projection system. Feature classes in both the schema has same data structure.
Our client needs to see these features combined in Lat/Long WGS 84 projection system.
We though of creating another schema containing views combining these feature classes and re-projecting them in Lat/Long, from S1 and S2. How can we create a view combining the feature classes from both the schemas? I thought of using UNION but it will slow down the performance. They have to be combined with optimal performance.
What can be the best way to get these feature classes in Lat/Long?
Regards
Sam
Yes.
Then instead of a materlized view I would use a common table with triggers on both source tables that do an upsert/deletes to the common table on update/insert/delete dml, de-projecting the data on the fly.
This will give you a "real-time" lat/lon data source with minimal CPU overhead.
Bryan
Similar Messages
-
View joining two spatial tables and strange CBO behaviour
Hi all,
I've following view in my database:
CREATE OR REPLACE VIEW my_view AS
SELECT id, 'table1' AS source, location FROM my_table1
UNION ALL
SELECT id, 'table2' AS source, location FROM my_table2;
When I execute query:
SELECT * FROM my_view WHERE SDO_RELATE(location, SDO_GEOMETRY(...), 'mask=anyinteract') = 'TRUE';
It works as expected.
When running query like (getting location with subquery):
SELECT * FROM my_view WHERE SDO_RELATE(location, (SELECT location FROM my_table3 WHERE id = 123, 'mask=anyinteract') = 'TRUE';
It doesn't work. Oracle Throws "DatabaseError: ORA-13226: interface not supported without a spatial index"
Further investigation revealed strange behaviour of CBO:
In first case Oracle CBO uses Spatial index just fine and as expected.
But second query and CBO get's a bit strange - unique index scan is used for subselect, but for view tables is full table scan is used and SDO_RELATE is not happy with that since no spatial index is used.
How I can use spatial indexes regardless of that subselect?Hi folks,
Looking over these responses and not finding a lot of clarity yet in terms of leaving a trail for future readers to glean an answer from. I was just looking through the back-and-forth and curious myself about the issue First of all I think Jani's observations are quite on target. This CBO reaction is weird and does not work they way most Oracle users would expect it to work. Secondly, Jani really should tell us his Oracle version and folks providing answers should as well - the CBO is always being tweaked. Thirdly, Stefan provides a solution though it's a rather expensive solution to my taste. And finally, I think we as a group need to spend a bit more time reproducing things in code. I will give it a shot, feel free to correct anything I got wrong.
So first of all, I wrote this up quick on 12.1.0.2 and verified it was the same on 11.2.0.4
DROP TABLE my_table1 PURGE;
CREATE TABLE my_table1(
objectid INTEGER NOT NULL
,tsource VARCHAR2(30 Char)
,shape MDSYS.SDO_GEOMETRY
,PRIMARY KEY(objectid)
DROP TABLE my_table2 PURGE;
CREATE TABLE my_table2(
objectid INTEGER NOT NULL
,tsource VARCHAR2(30 Char)
,shape MDSYS.SDO_GEOMETRY
,PRIMARY KEY(objectid)
DROP TABLE my_table3 PURGE;
CREATE TABLE my_table3(
objectid INTEGER NOT NULL
,tsource VARCHAR2(30 Char)
,shape MDSYS.SDO_GEOMETRY
,PRIMARY KEY(objectid)
CREATE OR REPLACE PROCEDURE seeder(
p_count IN NUMBER
AS
sdo_foo MDSYS.SDO_GEOMETRY;
int_counter NUMBER := 1;
FUNCTION random_line
RETURN MDSYS.SDO_GEOMETRY
AS
num_x1 NUMBER;
num_y1 NUMBER;
num_offx NUMBER;
num_offy NUMBER;
BEGIN
num_x1 := dbms_random.value(-179,179);
num_y1 := dbms_random.value(-89,89);
RETURN MDSYS.SDO_GEOMETRY(
2002
,8265
,NULL
,MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1)
,MDSYS.SDO_ORDINATE_ARRAY(
num_x1
,num_y1
,num_x1 + 0.0001
,num_y1 + 0.0001
END random_line;
BEGIN
FOR i IN 1 .. p_count
LOOP
sdo_foo := random_line();
INSERT INTO my_table1
VALUES (
int_counter
,'table1'
,sdo_foo
int_counter := int_counter + 1;
sdo_foo := random_line();
INSERT INTO my_table2
VALUES (
int_counter
,'table2'
,sdo_foo
int_counter := int_counter + 1;
sdo_foo := random_line();
INSERT INTO my_table3
VALUES (
int_counter
,'table3'
,sdo_foo
int_counter := int_counter + 1;
END LOOP;
INSERT INTO my_table1
VALUES (
0
,'table1'
,MDSYS.SDO_GEOMETRY(
2002
,8265
,NULL
,MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1)
,MDSYS.SDO_ORDINATE_ARRAY(
-87.8211111
,42.5847222
,-87.8212
,42.5848
INSERT INTO my_table3
VALUES (
0
,'table3'
,MDSYS.SDO_GEOMETRY(
2002
,8265
,NULL
,MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1)
,MDSYS.SDO_ORDINATE_ARRAY(
-87.8211111
,42.5848
,-87.8212
,42.5847222
COMMIT;
END seeder;
BEGIN
seeder(100000);
END;
SELECT 'my_table1: ' || COUNT(*) AS invalid_count FROM my_table1 WHERE MDSYS.SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT(shape,0.05) <> 'TRUE'
UNION ALL
SELECT 'my_table2: ' || COUNT(*) AS invalid_count FROM my_table2 WHERE MDSYS.SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT(shape,0.05) <> 'TRUE'
UNION ALL
SELECT 'my_table3: ' || COUNT(*) AS invalid_count FROM my_table3 WHERE MDSYS.SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT(shape,0.05) <> 'TRUE';
BEGIN
INSERT INTO user_sdo_geom_metadata(
table_name
,column_name
,diminfo
,srid
) VALUES (
'MY_TABLE1'
,'SHAPE'
,MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X',-180,180,.05),MDSYS.SDO_DIM_ELEMENT('Y',-90,90,.05))
,8265
COMMIT;
EXCEPTION
WHEN OTHERS
THEN
NULL;
END;
BEGIN
INSERT INTO user_sdo_geom_metadata(
table_name
,column_name
,diminfo
,srid
) VALUES (
'MY_TABLE2'
,'SHAPE'
,MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X',-180,180,.05),MDSYS.SDO_DIM_ELEMENT('Y',-90,90,.05))
,8265
COMMIT;
EXCEPTION
WHEN OTHERS
THEN
NULL;
END;
BEGIN
INSERT INTO user_sdo_geom_metadata(
table_name
,column_name
,diminfo
,srid
) VALUES (
'MY_TABLE3'
,'SHAPE'
,MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X',-180,180,.05),MDSYS.SDO_DIM_ELEMENT('Y',-90,90,.05))
,8265
COMMIT;
EXCEPTION
WHEN OTHERS
THEN
NULL;
END;
CREATE INDEX my_table1_spx ON my_table1
(shape)
INDEXTYPE IS MDSYS.SPATIAL_INDEX
NOPARALLEL;
CREATE INDEX my_table2_spx ON my_table2
(shape)
INDEXTYPE IS MDSYS.SPATIAL_INDEX
NOPARALLEL;
CREATE INDEX my_table3_spx ON my_table3
(shape)
INDEXTYPE IS MDSYS.SPATIAL_INDEX
NOPARALLEL;
BEGIN
dbms_stats.gather_table_stats(USER, 'MY_TABLE1');
dbms_stats.gather_index_stats(USER, 'MY_TABLE1_SPX');
dbms_stats.gather_table_stats(USER, 'MY_TABLE2');
dbms_stats.gather_index_stats(USER, 'MY_TABLE2_SPX');
dbms_stats.gather_table_stats(USER, 'MY_TABLE3');
dbms_stats.gather_index_stats(USER, 'MY_TABLE3_SPX');
END;
CREATE OR REPLACE VIEW my_view
AS
SELECT
objectid
,'table1' AS tsource
,shape
FROM
my_table1
UNION ALL
SELECT
objectid
,'table2' AS tsource
,shape
FROM my_table2;
set timing on;
-- QUERY #1
-- Jani's original setup, works as expected
SELECT
COUNT(*) AS single_geom_counter
FROM
my_view a
WHERE
MDSYS.SDO_RELATE(
a.shape
,MDSYS.SDO_GEOMETRY(
2002
,8265
,NULL
,MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1)
,MDSYS.SDO_ORDINATE_ARRAY(
-87.8211111
,42.5848
,-87.8212
,42.5847222
,'mask=anyinteract'
) = 'TRUE';
-- QUERY #2
-- Now the problem statement
SELECT
COUNT(*) AS table_problem_counter
FROM
my_view a
WHERE
MDSYS.SDO_RELATE(
a.shape
,(SELECT b.shape FROM my_table3 b WHERE b.objectid = 0)
,'mask=anyinteract'
) = 'TRUE';
-- QUERY #3
-- Stefan's solution
SELECT /*+ ORDERED */
COUNT(*) AS stefans_solution
FROM
my_table3 a
,my_view b
WHERE
a.objectid = 0
AND MDSYS.SDO_RELATE(
a.shape
,b.shape
,'mask=anyinteract'
) = 'TRUE';
Anyhow, so the hard coded query #1 that Jani provided works exactly the way most folks would expect, the second item in the relate is applied to each spatial index participating in the view. I think we can agree this is what we want.
Now when we move on to the problem, well its all goes off the rails as I think its looks to apply the spatial filter to the view itself which lacks an index (not sure really)
So as Stefan says, you can work around this by rewriting things as query #3 does above though now its a full table scan of both tables in the view. This is a long way performance wise from Query #1!
So on my 12c test box
query #1 Elapsed: 00:00:00.016
query #3 Elapsed: 00:00:33.534
On 11g production box
query #1 Elapsed: 00:00:00.49
query #3 Elapsed: 00:02:31.45 (ouch!)
So hopefully someone else can jump in with more information on better solutions?
I overall tend to avoid the kind of unioned views that Jani is using here. I have a hard time recalling why but I must have been burned similarly many years ago when I was first starting with Oracle spatial. I tend to always want my spatial indexes right there where I can keep a grim stink eye on them. It may be that a unioned view with multiple spatial indexes behind it might just be a bad practice better done with a materialized view? Or maybe a lesser term? Unprofitable practice? fraught? "Best if you don't do that"?
Anyhow, I would be interested in what others have as input on the matter.
Cheers,
Paul -
Combine multipe tables (with same schema) in one MeasureGroup?
With tables "FactsHistory" and "FactsToday" in the DWH (identical schema), how would one load a data union into the cube? We were planning to use one partition per table (one MOLAP, one ROLAP) and though it is probably easy to use then
in one logical table. I know how to speparate data of one table and use separate partitions and I could use a UNION operator to combine the tables in the ds view, but that would be suboptimal since the loading process would always require selecting the union
(lot of history data and small data from today; would be better to load the current data into the ROLAP partition separately).Hi timvdh,
You can simply create two partitions in your partition designer for the desired measure group, one (ROLAP) selecting from FactsToday and the other (or many more, since it'll be containing historical data) using MOLAP with the exact same SQL query but pointing
FactsHistory.
This way, in addition to the hot and cold data combination using ROLAP and MOLAP you'll get the option to process them individually. From your explanation I'm assuming that your scenario involves frequent daily data analysis (near real-time) and not-that-frequent
historical analysis.
Besides that, if you are using SQL Server 2012 or even better, 2014, consider the option of using columnar indexes to support your ROLAP queries.
Regards.
Pau -
Does CDC work on spatial tables?
I'm trying to prototype using change data capture on some spatial tables. I'm able to create the cdc tables and subsribe, etc. with no errors. But when I go to try and update a record in my spatial table I keep getting the following errors:
ERROR at line 1:
ORA-31495: error in synchronous change table on "FULL"."GEONAME_FEATURE"
ORA-01733: virtual column not allowed here
My non-spatial tables that I set up the same way work fine for updates and inserts.
The spatial CDC table and the base spatial table look the same. Is there something about Spatial that prohibits it from being used with change data capture?This might be related to bug 3561140 - we are working with the appropriate folks in Oracle to try to resolve it. If you can post your view definition then we can try to ensure this is fixed at the same time (a small test case would be appreciated).
-
i want to clone spatial tables from database 11g r2 to another one ?
i exported tables of my user using toad
export ---> export utility wizard ---> export tables--> select all tables from my User
and i imported it into my new User in new DB
but the styles, themes, base map & tile layer not found when i opened mapbuilder
also the view "USER_SDO_THEMES" is empty
i tried to export all database from my old machine and import it into my new machine by toad export ---> export utility wizard ---> export this DataBase
but i couldn't import it into my new machine as the oracle home was changed at new machine
I need urgent help
any help in resolving this would be greatly appreciated.
thanks.MapViewer related questions are best posted on the MapViewer forum:
MapViewer
Have a look at this blog for an answer to your question:
http://oracle-maps.blogspot.com/2009/04/how-to-exportimport-themes-styles-maps.html -
What is the easiest, most foolproof way of unloading (exporting) spatial tables?
The goal is to export the table, indices and any other related and required objects so this can be imported into a completely different instance of Oracle.Thanks for the reply, Dan.
We have hired a contractor to work on an editing application for us, so we needed to send them our tables. They claimed that they needed an export of the MDSYS schema, which we have discovered cannot be exported. I did not think they needed an export of MDSYS, and this information verifies this claim.
R Clement
Alaska Department of Natural Resources
To view a very fast Internet Map Service based on Oracle Spatial, see:
http://mapper.landrecords.info -
In mvdemo(Demo tables from oracle) we have tables STATES, COUNTIES, INTERSTATES and CITIES. So can I say that u should have a separate table for each Feature(Layer).
Suppose I have two Features CITIES and TOWNS both of them have the same non spatial fields. Here should I create two separate tables or a single table where I can put both the CITIES and TOWNS data.
Is there any advantage of putting similiar kind of data in two separate tables just because they are of different layers.Dan's advice is sound.
Just a comment to reinforce what Dan is suggesting.
Most people normally put towns, villages, cities etc in one table. Often
a single attribute is used to CLASSIFY them. This attribute can be
used to drive symbolisation so that cities are rendered with a symbol
differently from towns etc. If you are rendering all the records in the table
in a single map theme/layer by the classification attribute no performance
hit will be incurred.
However, if you decided to render the data into 3 separate themes then
problems might start to arise especially if the table was very large (for
example, it held all places in the world) and you decided to create views
over the base table to show only villages, only towns, only cities etc via
a WHERE clause that referenced this attribute
eg WHERE placetype = 'Village'
Then you just might start to hit some performance problems. Why? Because
whereever the number of values in a classification attribute is small (for example 3 - village, town, city) relative to the number of records in the table (say 1,000,000),
Oracle's query engine would probably prefer to do what is called a "full table scan"
each time someone extracts data from any one view. What about creatnig
an attribute index on the classification attribute, you might say? The problem
is that an attribute with this sort of value distribution is a poor attribute for
indexing. If you were in this situation, you would be better off splitting
the data into 3 tables.
regards
Simon -
How to select the data from a Maintainance View into an internal table
Hi All,
Can anybody tell me how to select the data from a Maintainance View into an internal table.
Thanks,
srinivas.HI,
You can not retrieve data from A mentenance view.
For detail check this link,
http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21ed2d446011d189700000e8322d00/content.htm
Regards,
Anirban -
Want to update data in a view based on multiple tables
Hi
I am facing a problem i want to update data in tables using a view. As that view is based on multiple tables so i am unable to update data. i came to know we can update table from view only if view is based on single table. so if anyone knows any alternative please let me know.
Thanx
DevinderDevinder,
The table can be updated through a view based on multiple tables, if and only if the table is a "key preserved" table. Rather than explaining myself, i avoided the burden of typing by finding the material in Oracle Docs and pasting it for you :-)
If you want a join view to be updatable, all of the following conditions must be
true:
1. The DML statement must affect only one table underlying the join.
2. For an INSERT statement, the view must not be created WITH CHECK
OPTION, and all columns into which values are inserted must come from a
key-preserved table. A key-preserved table in one for which every primary
key or unique key value in the base table is also unique in the join view.
3. For an UPDATE statement, all columns updated must be extracted from a
key-preserved table. If the view was created WITH CHECK OPTION, join
columns and columns taken from tables that are referenced more than once
in the view must be shielded from UPDATE.
4. For a DELETE statement, the join can have one and only one key-preserved
table. That table can appear more than once in the join, unless the view was
created WITH CHECK OPTION.
HTH
Naveen -
Hi all,
I am developing a report for which I am fetching fields from CDPOS & CDHDR tables (both r cluster tables). when i run st05, it fetches values from a cluster table CDCLS which takes most of the database time.
Is there any view for CDPOS & CDHDR tables?
How to find the views for cluster tables?
Thanx in advance.
Vijay.hi,
check this code,
here i used function module to get details of cdhdr,cdpos.
TABLES : MARC.
DATA :BEGIN OF GI_MARC OCCURS 0,
MATNR LIKE MARC-MATNR,
WERKS LIKE MARC-WERKS,
DISPO LIKE MARC-DISPO,
END OF GI_MARC.
DATA : CHAR TYPE I,
COUNT TYPE I,
VAR TYPE I.
DATA : BEGIN OF GI_FINAL OCCURS 2000,
MATNR LIKE MARC-MATNR,
DISPO LIKE MARC-DISPO,
USERNAME LIKE CDHDR-USERNAME,
UDATE LIKE CDHDR-UDATE,
UTIME LIKE CDHDR-UTIME,
TCODE LIKE CDHDR-TCODE,
TABNAME LIKE CDPOS-TABNAME,
TABKEY LIKE CDPOS-TABKEY,
FNAME LIKE CDPOS-FNAME,
VALUE_NEW LIKE CDPOS-VALUE_NEW,
VALUE_OLD LIKE CDPOS-VALUE_OLD,
CHANGENR LIKE CDHDR-CHANGENR,
END OF GI_FINAL.
DATA : MATNR LIKE MARC-MATNR,
DISPO LIKE MARC-DISPO,
USERNAME1 LIKE CDHDR-USERNAME,
UDATE1 LIKE CDHDR-UDATE,
UTIME LIKE CDHDR-UTIME,
TCODE LIKE CDHDR-TCODE,
CHANGENR LIKE CDHDR-CHANGENR.
DATA : GI_CDHDR LIKE CDHDR OCCURS 0 WITH HEADER LINE.
DATA : GI_CDPOS LIKE CDPOS OCCURS 0 WITH HEADER LINE.
DATA : OBJECTCLAS LIKE CDHDR-OBJECTCLAS VALUE 'MATERIAL',
OBJECTID LIKE CDHDR-OBJECTID,
USERNAME LIKE CDHDR-USERNAME VALUE 'RSS-SPE',
UDATE LIKE CDHDR-UDATE VALUE '20070101',
CHANGE_IND LIKE CDHDR-CHANGE_IND VALUE 'U'.
type-pools: slis.
data: gt_slis_fcat type slis_t_fieldcat_alv.
data: gt_fieldcat type slis_t_fieldcat_alv.
*data: gt_fieldcatall type slis_t_fieldcat_alv.
data: g_repid like sy-repid.
data: gs_layout type slis_layout_alv.
gs_layout-zebra = 'X'.
gs_layout-colwidth_optimize = 'X'.
SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-110.
SELECT-OPTIONS : P_DISPO FOR MARC-DISPO.
SELECT-OPTIONS : RECORDS FOR CHAR.
SELECTION-SCREEN : END OF BLOCK B1.
START-OF-SELECTION.
perform process_data.
perform f_fieldcat_init using gt_fieldcat[].
perform alv_display tables gi_final using gt_fieldcat[].
form process_data.
SELECT MATNR WERKS DISPO FROM MARC INTO TABLE GI_MARC
WHERE DISPO IN P_DISPO
AND WERKS = '1011'." Becoz we hav to chk the
the changes made in the material while extendin tht matrl frm 1011 to
*other plant.
IF NOT GI_MARC[] IS INITIAL.
IF NOT RECORDS-LOW IS INITIAL .
IF NOT RECORDS-HIGH IS INITIAL.
DESCRIBE TABLE GI_MARC LINES COUNT.
IF RECORDS-HIGH < COUNT.
DELETE GI_MARC FROM RECORDS-HIGH TO COUNT.
ENDIF.
IF RECORDS-LOW <> 1.
IF RECORDS-LOW <> 0.
DELETE GI_MARC FROM 1 TO RECORDS-LOW.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
LOOP AT GI_MARC.
CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
EXPORTING
INPUT = GI_MARC-MATNR
IMPORTING
OUTPUT = GI_MARC-MATNR
EXCEPTIONS
LENGTH_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
OBJECTID = GI_MARC-MATNR .
CALL FUNCTION 'CHANGEDOCUMENT_READ_HEADERS'
EXPORTING
ARCHIVE_HANDLE = 0
DATE_OF_CHANGE = UDATE
OBJECTCLASS = OBJECTCLAS
OBJECTID = OBJECTID
TIME_OF_CHANGE = '000000'
USERNAME = USERNAME
LOCAL_TIME = ' '
DATE_UNTIL = '99991231'
TIME_UNTIL = '235959'
TABLES
I_CDHDR = GI_CDHDR
EXCEPTIONS
NO_POSITION_FOUND = 1
WRONG_ACCESS_TO_ARCHIVE = 2
TIME_ZONE_CONVERSION_ERROR = 3
OTHERS = 4
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'ARCH_ANA_PROGRESS_INDICATOR'
EXPORTING
TEXT = 'Processing'.
IF NOT GI_CDHDR[] IS INITIAL.
LOOP AT GI_CDHDR.
MOVE GI_MARC-MATNR TO GI_FINAL-MATNR.
MOVE GI_MARC-DISPO TO GI_FINAL-DISPO.
MOVE GI_CDHDR-USERNAME TO GI_FINAL-USERNAME.
MOVE GI_CDHDR-UDATE TO GI_FINAL-UDATE.
MOVE GI_CDHDR-TCODE TO GI_FINAL-TCODE.
MOVE GI_CDHDR-CHANGENR TO GI_FINAL-CHANGENR.
VAR = 1.
CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
EXPORTING
INPUT = GI_FINAL-MATNR
IMPORTING
OUTPUT = GI_FINAL-MATNR
EXCEPTIONS
LENGTH_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
ENDIF.
OBJECTID = GI_FINAL-MATNR ."to ensure that objid is in proper
*format
SELECT *
FROM CDPOS
INTO TABLE GI_CDPOS
PACKAGE SIZE 100
FOR ALL ENTRIES IN GI_cdhdr
WHERE OBJECTID = OBJECTID
AND CHANGENR = GI_CDHDR-CHANGENR
AND OBJECTCLAS = OBJECTCLAS
AND CHNGIND = CHANGE_IND." only those values will b
*takn which have been modified nd nt created
IF SY-SUBRC = 0.
LOOP AT GI_CDPOS.
MOVE GI_MARC-MATNR TO GI_FINAL-MATNR.
MOVE GI_MARC-DISPO TO GI_FINAL-DISPO.
MOVE GI_CDHDR-USERNAME TO GI_FINAL-USERNAME.
MOVE GI_CDHDR-UDATE TO GI_FINAL-UDATE.
MOVE GI_CDHDR-TCODE TO GI_FINAL-TCODE.
MOVE GI_CDHDR-CHANGENR TO GI_FINAL-CHANGENR.
MOVE GI_CDPOS-TABNAME TO GI_FINAL-TABNAME.
MOVE GI_CDPOS-TABKEY TO GI_FINAL-TABKEY.
MOVE GI_CDPOS-FNAME TO GI_FINAL-FNAME.
MOVE GI_CDPOS-VALUE_NEW TO GI_FINAL-VALUE_NEW.
MOVE GI_CDPOS-VALUE_OLD TO GI_FINAL-VALUE_OLD.
APPEND GI_FINAL.
CLEAR GI_FINAL.
ENDIF.
VAR = VAR + 1.
ENDSELECT.
ENDLOOP.
ENDIF.
ENDLOOP.
CALL FUNCTION 'ARCH_ANA_PROGRESS_INDICATOR'
EXPORTING
TEXT = 'Processing'.
ENDIF.
ENDLOOP.
endform.
form f_fieldcat_init using lt_fieldcat type slis_t_fieldcat_alv.
data: ls_fieldcat type slis_fieldcat_alv.
clear ls_fieldcat.
ls_fieldcat-fieldname = 'MATNR'.
ls_fieldcat-seltext_l = 'Material number'.
ls_fieldcat-tabname = 'GI_final'.
append ls_fieldcat to lt_fieldcat.
clear ls_fieldcat.
ls_fieldcat-fieldname = 'DISPO'.
ls_fieldcat-seltext_l = 'mrp controller'.
append ls_fieldcat to lt_fieldcat.
clear ls_fieldcat.
ls_fieldcat-fieldname = 'USERNAME'.
ls_fieldcat-seltext_l = 'Username'.
append ls_fieldcat to lt_fieldcat.
clear ls_fieldcat.
ls_fieldcat-fieldname = 'CHANGENR'.
ls_fieldcat-seltext_l = 'Change Number'.
append ls_fieldcat to lt_fieldcat.
clear ls_fieldcat.
ls_fieldcat-fieldname = 'UDATE'.
ls_fieldcat-seltext_l = 'modified date'.
append ls_fieldcat to lt_fieldcat.
clear ls_fieldcat.
ls_fieldcat-fieldname = 'UTIME'.
ls_fieldcat-seltext_l = 'MODIFIED TIME'.
append ls_fieldcat to lt_fieldcat.
clear ls_fieldcat.
ls_fieldcat-fieldname = 'UDATE'.
ls_fieldcat-seltext_l = 'MODIFIED DATE'.
append ls_fieldcat to lt_fieldcat.
clear ls_fieldcat.
ls_fieldcat-fieldname = 'TCODE'.
ls_fieldcat-seltext_l = 'TRANSACTION CODE'.
append ls_fieldcat to lt_fieldcat.
clear ls_fieldcat.
ls_fieldcat-fieldname = 'TABNAME'.
ls_fieldcat-seltext_l = 'TABLE NAME'.
append ls_fieldcat to lt_fieldcat.
clear ls_fieldcat.
ls_fieldcat-fieldname = 'TABKEY'.
ls_fieldcat-seltext_l = 'TABLE KEY'.
append ls_fieldcat to lt_fieldcat.
clear ls_fieldcat.
ls_fieldcat-fieldname = 'FNAME'.
ls_fieldcat-seltext_l = 'FNAME'.
append ls_fieldcat to lt_fieldcat.
clear ls_fieldcat.
ls_fieldcat-fieldname = 'FVALUE'.
ls_fieldcat-seltext_l = 'FVALUE'.
append ls_fieldcat to lt_fieldcat.
clear ls_fieldcat.
ls_fieldcat-fieldname = 'VALUE_NEW'.
ls_fieldcat-seltext_l = 'NEW VALUE'.
append ls_fieldcat to lt_fieldcat.
clear ls_fieldcat.
ls_fieldcat-fieldname = 'VALUE_OLD'.
ls_fieldcat-seltext_l = 'OLD VALUE'.
append ls_fieldcat to lt_fieldcat.
endform. " f_fieldcat_init
form alv_display tables gi_final using gt_fieldcat .
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = ' Material list '
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_STRUCTURE_NAME =
is_layout = gs_layout
it_fieldcat = gt_fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
tables
t_outtab = gi_final
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endform.
regards
siva -
How to CREATE VIEW to merge two tables each of which has CLOB-typed column
I failed in creating a view to merge two tables that have CLOB-type column each.
The details are:
Database: Oracle 9i (9.2.0)
Two tables "test" and "test_bak", each of which has the following structure:
ID Number(10, 0)
DUMMY VARCHAR2(20)
DUMMYCLOB CLOB
The following operation fails:
create view dummyview (id, dummy, dummyclob) as
select id, dummy, dummyclob from test
union
select id, dummy, dummyclob from test_bak;
I was announced:
select test.id, test.dummy, test.dummyclob
ERROR in line 2:
ORA-00932: inconsistent data type: required - , but CLOB presented.
But if creating views from only ONE table with CLOB-type columns, or from two tables WITHOUT CLOB-typed columns, the creation will succeed. The following 1) and 2) will succeed, both:
1) one table, with CLOB-typed column
create view dummyview (id, dummy, dummyclob) as
select id, dummy, dummyclob from test;
2) two tables, without CLOB-typed columns
create view dummyview (id, dummy) as
select id, dummy from test
union
select id, dummy from test_bak;
I want to merge the two tables all, with complete columns, how to write the CREATE VIEW SQL statement?
many thanks in advanceDong Wenyu,
No.
But you could do this:
SELECT source.*, nvl (tab1.clob_column, tab2.clob_column)
FROM your_table1 tab1, your_table2 tab2, (
SELECT primary_key, ...
FROM your_table1
UNION
SELECT primary_key, ...
FROM your_table2
) source
WHERE source.primary_key = tab1.id (+)
AND source.primary_key = tab2.id (+)
In other words, do the set operation (UNION (ALL)/INTERSECT/MINUS) on just the PK columns before pulling in the LOB columns.
d. -
ORA-01776: I can't insert on a view comprised by two tables
Good morning:
I'm trying to do an insertion on a view comprised by the join of two tables (departments and employees) and it failed.
The view is this one:
CREATE OR REPLACE FORCE VIEW "EMPDPTO" ("EMPLOYEE_ID", "LAST_NAME", "EMAIL", "HIRE_DATE", "JOB_ID", "DEPARTMENT_ID", "DEPARTMENT_NAME") AS
SELECT employee_id, last_name, email, hire_date, job_id, d.department_id, department_name
FROM employees e, departments d
WHERE e.department_id = d.department_id
My insertion command
INSERT INTO empdpto
VALUES(743, 'Bermejo', '[email protected]', '12/12/09', 'IT_PROG', 10, 'Administration');
throws a ORA-01776: it's not possible to modify more than one base table through a join union.
On the other side I've seen in documentation that in certain circunstances is possible to do an insertion on a complex view.
Is it possible to do an insertion on a view comprised by two tables?. Under what circunstances?.
ThanksFrom SQL Reference CREATE VIEW section Notes on Updatable Views http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_8004.htm#i2065510
>
If you want a join view to be updatable, then all of the following conditions must be true:
The DML statement must affect only one table underlying the join.
For an INSERT statement, the view must not be created WITH CHECK OPTION, and all columns into which values are inserted must come from a key-preserved table. A key-preserved table is one for which every primary key or unique key value in the base table is also unique in the join view.
For an UPDATE statement, the view must not be created WITH CHECK OPTION, and all columns updated must be extracted from a key-preserved table.
>
The first condition is not true for the view you have created.
Edited by: P. Forstmann on 26 janv. 2010 20:17 -
Reg :-maintain a table maintenance view for the z table.suggest me the code
i have question.i have created a z table related to pp module.the requirement is to maintain {table maintenance view} for this z table.how could this be done.can any one suggest me the code for this?
Hi ,
We have a lots of queries on table maintainance creation in the forum posted and replied to.Pls have a look at it first.
In se11 -> change mode of the ztable -> goto -> utilities -> table maintainance generator -> click on it...
it will give a new screen-> enter the required details like function group , authorisation(use &NC& or leave it blank if you dont know) and screens
2 step and 1 step means=> number of screens displayed in maintainace
if step1 is selected then we have a screen which will be like a table control for data entry.........
for step2 we have a table control screen and a more detailed individual field display as second screen
click on the button 'find screen numbers' so that system automatically proposes the screen numbers
after which click on the "create" button and follow the required instructions/messages
once done go to SM30 enter the table name to check if maintainance has been created properly
Hope it helps,Pls check and revert
Regards
Byju -
Maintenance view program for a table
Hi All,
How can i create a maintenance view program for a table. i did maintenance view in sm30 for that table. now it needs a transaction code for maintenance. can somebody help me with this.
Thanks,
KiranHi
Create a new transaction Z**** linked to SM30 for that table:
- trx SE93: while creating trx choose transaction with parameter and insert these data:
- TRANSACTION = SM30
- set the flag SKIP INITIAL SCREEN
At the end of screen, section Default Value, if you want to open dialog for updating:
NAME OF SCREEN FIELD VALUE
VIEWNAME <here insert the table name>
UPDATE X
...for displaying:
NAME OF SCREEN FIELD VALUE
VIEWNAME <here insert the table name>
SHOW X
Max -
More than one SDO_GEOMETRY columns in one Oracle 8i spatial table
I have a spatial table as follows:
CREATE TABLE TEST(
ID VARCHAR2(255) NOT NULL,
POINT MDSYS.SDO_GEOMETRY,
LINE MDSYS.SDO_GEOMETRY,
POLYGON MDSYS.SDO_GEOMETRY,
PRIMARY KEY(ID));
Is it a good practice to have more than one SDO_GEOMETRY columns
in one spatial table? What are the drawbacks if any to have a
spatial with more than one layer?I have one question about more than one SDO_GEOMETRY columns
in one table in Oracle 8.1.7. When I wanted to create two
spatial indices for this table, every time I got some error.
Can anyone tell me how to figure it out?
Thanks very much,
Fan Fan,
You need to insert metadata record before creating spatial
indices.
Try the following:
REM USER_SDO_GEOM_METADATA :
REM insert a row for the geom layer for TEST TEST2 tables
REM
INSERT INTO USER_SDO_GEOM_METADATA
( TABLE_NAME, COLUMN_NAME, DIMINFO, SRID)
VALUES ('TEST', 'POINT', MDSYS.SDO_DIM_ARRAY
(MDSYS.SDO_DIM_ELEMENT('LON', -180,
180, .000005),MDSYS.SDO_DIM_ELEMENT('LAT', -90, 90, .000005)),
NULL);
INSERT INTO USER_SDO_GEOM_METADATA
( TABLE_NAME, COLUMN_NAME, DIMINFO, SRID)
VALUES ('TEST', 'LINE', MDSYS.SDO_DIM_ARRAY
(MDSYS.SDO_DIM_ELEMENT('LON', -180,
180, .000005),MDSYS.SDO_DIM_ELEMENT('LAT', -90, 90, .000005)),
NULL);
INSERT INTO USER_SDO_GEOM_METADATA
( TABLE_NAME, COLUMN_NAME, DIMINFO, SRID)
VALUES ('TEST', 'POLYGON', MDSYS.SDO_DIM_ARRAY
(MDSYS.SDO_DIM_ELEMENT('LON', -180,
180, .000005),MDSYS.SDO_DIM_ELEMENT('LAT', -90, 90, .000005)),
NULL);
REM create a spatial index based on TRAFFIC.GEOM
REM
REM
CREATE INDEX TEST_G_POINT_IDX ON TEST(POINT) INDEXTYPE IS
MDSYS.SPATIAL_INDEX;
CREATE INDEX TEST_G_LINE_IDX ON TEST(LINE) INDEXTYPE IS
MDSYS.SPATIAL_INDEX;
CREATE INDEX TEST_G_POLYGON_IDX ON TEST(POLYGON) INDEXTYPE IS
MDSYS.SPATIAL_INDEX; -
Error while updating spatial table
Hi,
When i try to update a spatial table with the following syntax i get the below error,
UPDATE tab1 SET MP = 1, AT = 3,
RDATE = TO_DATE('30:04:2001:16:04:08', 'DD:MM:YYYY:HH24:MI:SS'),
ODATE = TO_DATE('30:12:1899:00:00:00', 'DD:MM:YYYY:HH24:MI:SS'),
REP = 1
WHERE ID = 7
ERROR at line 1:
ORA-29877: failed in the execution of the ODCIINDEXUPDATE routine
ORA-00600: internal error code, arguments: [kcbgtcr_1], [], [], [], [], [],
Any idea why is this happening??
Thanks
Shiva
nullHi Dan,
we are using oracle 8.1.6.3 on Solaris 8.
Table description is as follows.
ID NOT NULL NUMBER(10)
ROUTE_NUMBER NOT NULL VARCHAR2(255)
MP NUMBER(8,3)
GEOM MDSYS.SDO_GEOMETRY
AT NUMBER(10)
RDATE DATE
CDATE DATE
ODATE DATE
REPORT NUMBER(10)
CLEAR NUMBER(10)
OFFER NUMBER(10)
X NUMBER(8,6)
Y NUMBER(8,6)
This table has a valid entry in the user_sdo_geom_metadata table. And the spatial index is valid.
Thanks
Shiva
Maybe you are looking for
-
Hi, We have Oracle 10.2 and Windows 2003. We have Oracle on Cluster (with Windows software). When the System are without cluster all its OK!!!!!! We have 2 Resources Cluster Group: Oracle and Applications. We have Oracle in Oracle cluster group. We
-
Help! Save to remote server has broken links to all images
Okay, I (now) know this was a stupid thing to do - but surely there must be an easy way to rectify it...!? I usually 'PUT' the html files to the remote server, once they have been saved locally. But I keep getting frustrated with the uploading of all
-
If you had updated your iPhone 4S To iOS 7.0.3 From iOS 6.1.3 Would it brick your iPhone?
-
Account's APIs...
Hi Experts, I am working on Accounts topic so i want to know that SAP provides Accounts APIs or not... Thanx in Advance. Kind Regards Yogesh
-
WHEN WILL JDeveloper 10.1.3 go production?
what's the expect time line? I would like to use it's JSF features in my prod env.