By selecting GeoRaster portions using SQL
HelloI am interested in the selection of a portion of an image stored in the format inside the Oracle GeoRaster. After reviewing the documentation, I can see that there is something useful in the oracle.spatial.georaster.image.GeoRasterImage - in particular the method:
public getRasterImage (int pyramidLevel, JGeometry window) RenderedImage
However looking at the sample code provided in the API:
...
an object GeoRaster reading from database based on a request
ResultSet rs = statement.executeQuery ("" SELECT a.georaster FROM georaster_table where a.georaster.rasterdatatable =' RTD ' and a.georaster.rasterid = 1 ");
Geor rs.getObject = STRUCT (1) (oracle.sql.STRUCT);
construct a JGeoRaster object
JGeoRaster geoRaster = new JGeoRaster (geor);
get GeoRasterImage instance
GeoRasterImage geoRasterImage = geoRaster.getGeoRasterImageObject ();
retrieve a subset of the GeoRaster object as a Java image
RenderedImage image = geoRasterImage.getRasterImage (0,0,0,100,100);
...
You can see the code to get the result set uses the ID unique raster to get initial, then later in the code the subpicture is recovered by using the desired coordinates and the level of the pyramid.
But my question is this: get the set of results in this way requires the rasterid to be known as advance, who denies the whole reason/ability to select a secondary image based on coordinates/bounding box.
How can I do a SELECT statement using a box enclosing and level of the pyramid?
I hope this makes sense
Thank you
HD
N °
Tags: Database
Similar Questions
-
Select quarterly data using SQL
All-
The database version that I use is 10.2.0.4.0
This is probably simple, but for the life of me, I can't understand it. I have a table of approximately 200 Codes and a table that contains millions of records that are obliterated (data are from 1995 to sysdate). I need a query for a view to be used in a report that will show you the different codes used by the employee for specific areas based on a date parameter. If they have no data for this quarter I want to still show the quarter show 0 for the number.
I created this simple example. If I see someone how I can integrate this logic in what I do.
SQL for the test data:
create the table bunch_of_codes
(id_code number (12) primary key,)
Description varchar2 (10));
insert into bunch_of_codes
values (1, 'APPLE');
insert into bunch_of_codes
values (2, 'ORANGE');
insert into bunch_of_codes
values (3, 'GRAPE');
create the table bunch_of_data
(id_code, number (12),)
date of activity_date,
CONSTRAINT data_id_code
FOREIGN KEY (id_code) REFERENCES bunch_of_codes (id_code));
INSERT INTO bunch_of_data
VALUES (1, to_date('4/12/2011','MM/DD/YYYY'));
INSERT INTO bunch_of_data
VALUES (1, to_date('6/1/2011','MM/DD/YYYY'));
INSERT INTO bunch_of_data
VALUES (3, to_date('1/15/2011','MM/DD/YYYY'));
INSERT INTO bunch_of_data
VALUES (3, to_date('4/17/2011','MM/DD/YYYY'));
INSERT INTO bunch_of_data
VALUES (3, to_date('11/11/2011','MM/DD/YYYY'));
COMMIT;
What I see when I run the SQL statement is:
DESCRIPTION QUARTER COUNTY
----------- ------- -----
APPLE 1 0
2 2 APPLE
APPLE 3 0
APPLE 4 0
1 1 GRAPE
1 2 GRAPES
GRAPES 3 0
4 1 GRAPE
ORANGE 1 0
ORANGE 2-0
ORANGE 3 0
ORANGE 4 0
I need each printed code without worrying if it was not used. If it has not been used, I want to still see each quarter but show 0 for count.
For this example, I can run this SQL to join the data:
Select c.description,
to_char(d.activity_date,'Q') quarter,
Count County (d.id_code)
of bunch_of_codes c,.
bunch_of_data d
where c.id_code = d.id_code
C.description group, to_char(d.activity_date,'Q')
order of description, quarter
But if it is not no matter how much detail for the quarter then I don't get a row of data. I tried all sorts of things, but nothing seems to work.
Please help if you have any ideas.Hi MLBrown,
Here's a query that gives what you asked.
Note: My table bunch_of_data has three lines that you have published, more a fourth line (the activity_date of this row is April 12, 2010, in the format DD-MON-YYYY).
To account for the response you gave to the question of Etbin, a column Y (for data year) is included in the output. In this output, there is for the year, Q for the quarter and the total for the count.SQL> select * from bunch_of_codes; ID_CODE DESCRIPTION ---------- ----------- 1 APPLE 2 ORANGE 3 GRAPE SQL> select * from bunch_of_data; ID_CODE ACTIVITY_DATE ---------- --------------- 1 12-APR-2010 1 12-APR-2011 1 01-JUN-2011 3 15-JAN-2011 3 17-APR-2011 3 11-NOV-2011 6 rows selected. SQL> with a as(select mi + level - 1 as y 2 from (select min(extract(year from activity_date)) mi, 3 max(extract(year from activity_date)) ma 4 from bunch_of_data 5 ) 6 connect by level <= ma - mi + 1 7 ), 8 qt as(select '1' q from dual 9 union all 10 select '2' from dual 11 union all 12 select '3' from dual 13 union all 14 select '4' from dual), 15 allt as(select b.id_code,b.description,a.y, qt.q as q 16 from bunch_of_codes b,a,qt 17 ), 18 temp as(select id_code,y,q,count(1) co 19 from (select bd.id_code,extract(year from bd.activity_date) y, 20 to_char(bd.activity_date,'Q') q 21 from bunch_of_data bd) 22 group by id_code, y,q) 23 select allt.id_code,allt.description,allt.y,allt.q,nvl(co,0) total 24 from allt,temp 25 where allt.id_code =temp.id_code(+) 26 and allt.y=temp.y(+) 27 and allt.q=temp.q(+) 28 order by allt.id_code, allt.y, allt.q; ID_CODE DESCRIPTION Y Q TOTAL ---------- ----------- ---------- - ---------- 1 APPLE 2010 1 0 1 APPLE 2010 2 1 1 APPLE 2010 3 0 1 APPLE 2010 4 0 1 APPLE 2011 1 0 1 APPLE 2011 2 2 1 APPLE 2011 3 0 1 APPLE 2011 4 0 2 ORANGE 2010 1 0 2 ORANGE 2010 2 0 2 ORANGE 2010 3 0 ID_CODE DESCRIPTION Y Q TOTAL ---------- ----------- ---------- - ---------- 2 ORANGE 2010 4 0 2 ORANGE 2011 1 0 2 ORANGE 2011 2 0 2 ORANGE 2011 3 0 2 ORANGE 2011 4 0 3 GRAPE 2010 1 0 3 GRAPE 2010 2 0 3 GRAPE 2010 3 0 3 GRAPE 2010 4 0 3 GRAPE 2011 1 1 3 GRAPE 2011 2 1 ID_CODE DESCRIPTION Y Q TOTAL ---------- ----------- ---------- - ---------- 3 GRAPE 2011 3 0 3 GRAPE 2011 4 1 24 rows selected. SQL>
Edited by: Manguilibe Jan 28 KAO. 2012 01:06
-
After a SELECT INTO, the use of the result as a parameter to another SQL variable?
Hello world
My apologies for these basic questions, but I need your help in order to run the report in STATSPACK (spreport.sql) in a NON-interactive manner.
To do this, I need 3 parameters:
- begin_snap
- end_snap
- report_name
I have a version of the report named spreportBH.sql. This sql receives 3 parameters and generates the report success.
SQL > @spreportBH.sql 923 1111 /u01/BHB/test4.txt
For this example begin_snap=923, end_snap=1111 and report_name is /u01/BHB/test4.txt
My problem is that the snapid must be calculated based on the date.
To achieve this goal, I can query the table STATS$ SNAPSHOT.
For example, this query gives me the 923:
Select min (snap_id)
de PERFSTAT . STATS$ SNAPSHOT
où snap_time >= TO_DATE ('12-06-2014','dd-mm-YYYY');
I know that I can put the value in a variable. For this, I'm doing:
sqlplus "virtue sysdba" s < <! 1 > > ${fichier_de_sortie} 2 > > ${error_file}
DECLARE
firstSnapId NUMBER;
BEGIN
Select min (snap_id) INTO firstSnapId
of PERFSTAT. STATS\$ SNAPSHOT
where snap_time > = to_date ('12-06-2014', ' dd-mm-YYYY');
END;
/
!
How can I use firstSnapId to call @spreportBH.sql?
I'd appreciate any help that can give me.
Thank you d ' attribute
Bety
Hi, Bety,
So, you want to call a script in SQL * more. I'm not suggesting using PL/SQL use SQL * Plus Substitution Variable instead.
-The following command of the COLUMN said that everything which appears in a column called
-firstSnapIdCol will also go in a variable of substtitution called firstSnapId
COLUMN firstSnapIdCol new_value by firstSnapId
Select min (snap_id) AS firstSnapIdCol
of PERFSTAT. STATS$ SNAPSHOT
where snap_time > = to_date (6 December 2014 ", 'dd-mm-YYYY');
-Now that firstSnapId has a value, we can use it like this:
@spreportBH.sql & firstSnapID 1111 /u01/BHB/test14.txt
-
XML data in the table using sql/plsql
Hi experts,
Could you please help with the following requirement. I have the tags xml (.xml on a server file) below. I need to access this file and read the XML and insert into the db table using sql and plsql. Is it possible with the cdata below? And there is a nested this table.
Could someone please guide me if you have a sample code file and xml.
<? XML version = "1.0" encoding = "UTF-8"? >
< generation_date > <! [CDATA [17/11/2015]] > < / generation_date >
< generated_by > <! [CDATA [Admin Admin]] > < / generated_by >
< year > <! [CDATA [2015]] > < / year >
< month > <! [CDATA [01]] > < / month >
< author >
< author > <! [CDATA [user author]] > < / author > < author_initial > <! [CDATA [user]] > < / author_firstname > < author_country > <! [CDATA [author]] > < / author_lastname >
< author_email > <! [CDATA [[email protected]]] > < / author_email >
< author_data_01 > <! [CDATA []] > < / author_data_01 >
< author_data_02 > <! [CDATA []] > < / author_data_02 >
< items >
< article_item >
< article_id > <! [CDATA [123456]] > < / article_id >
< publication > <! [CDATA [Al Bayan]] > < / publication >
< section > <! [CDATA [Local]] > < / section >
< issue_date > <! [CDATA [11/11/2015]] > < / issue_date >
< page > <! [CDATA [2]] > < / print this page >
< article_title > <! [CDATA [title.]] > < / article_title > < number_of_words > <! [CDATA [165]] > < / number_of_words >
< original_price > <! [CDATA [200]] > < / original_price >
< original_price_currency > <! [CDATA [DEA]] > < / original_price_currency >
< price > <! [CDATA [250]] > < / price >
< price_currency > <! [CDATA [DEA]] > < / price_currency >
< / article_item >
< / articles >
< total_amount > <! [CDATA [250]] > < / total_amount >
< total_amount_currency > <! [CDATA [DEA]] > < / total_amount_currency >
< / author >
< / xml >
Thanks in advance,
Suman
XMLTABLE using...
SQL > ed
A written file afiedt.buf1 with t (xml) as (select xmltype ('))
2 ") of the double)"
3
4
5
6
7
8
9
10
11
[[12[email protected]]] >
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34-
35 end of sample data
36-
37 - assumptions:
(38 - a) XML may have several tags
(39 - b) eachmay contain more
40-
41 select x.gen_by, x.gen_date, x.mn, x.yr
42, y.author, y.auth_fn, y.auth_ln, y.auth_cnt, y.auth_em, y.auth_d1, y.auth_d2
43, z.id, z.pub, z.sec, z.iss_dt, z.pg, z.art_ttl, z.num_wrds, z.oprice, z.ocurr, z.price, z.curr
44 t
45, xmltable ('/ authxml')
from $ 46 t.xml
path of 47 columns gen_date varchar2 (10) '. / generation_date'
48, path of varchar2 (15) of gen_by '. / generated_by'
49, path of varchar2 (4) year '. "/ year"
50 varchar2 (2) mn road '. "/ month"
51, path of xmltype authors '.'
52 ) x
53, xmltable ('/ authxml/authors ')
from $ 54 x.authors
author of 55 path of varchar2 columns (15) '. / author'
56, path of varchar2 (10) of auth_fn '. / author_firstname'
57, path of varchar2 (10) of auth_ln '. / author_lastname'
58 road of VARCHAR2 (3) auth_cnt '. / author_country'
59 road of varchar2 (20) of auth_em '. / author_email'
60 road of varchar2 (5) of auth_d1 '. / author_data_01'
61, path of varchar2 (5) of auth_d2 '. / author_data_02'
62, path of xmltype articles '. / Articles'
63 ) y
64, xmltable ('/ Articles/article_item ')
from $ 65 y.articles
path id 66 number columns '. / article_id'
67, path of varchar2 (10) pub '. ' / publication.
68 road of varchar2 (10) dry '. / section'
69, path of varchar2 (10) of iss_dt '. / issue_date'
70 road of VARCHAR2 (3) pg '. "/ print this page"
71, path of varchar2 (20) of art_ttl '. / article_title'
72, path of varchar2 (5) of num_wrds '. / number_of_words'
73, path of varchar2 (5) of oprice '. / original_price'
74 road to VARCHAR2 (3) ocurr '. / original_price_currency'
75, path of varchar2 (5) price '. "/ price"
76, path of VARCHAR2 (3) curr '. / price_currency'
77* ) z
SQL > /.GEN_DATE GEN_BY YEAR MN AUTHOR AUTH_FN AUTH_LN AUT AUTH_EM AUTH_ AUTH_ ID PUB DRY ISS_DT PG ART_TTL NUM_W OPRIC HEARTS PRICE OCU
---------- --------------- ---- -- --------------- ---------- ---------- --- -------------------- ----- ----- ---------- ---------- ---------- ---------- --- -------------------- ----- ----- --- ----- ---
17/11/2015 Admin Admin 2015 01 user author user author [email protected] 123456 UAE Al Bayan Local 11/11/2015 2 is the title. 165 200 AED AED 250Of course, you'll want to change the types of data, etc. as needed.
I assumed that the XML can contain several "
" sections and that each section can contain several entries. Thus the XMLTABLE aliasing as 'x' gives information of XML, and supplies the data associated with the XMLTABLE with alias 'y' which gets the multiple authors, which itself
section of the XMLTABLE with alias 'z' for each of the article_item. CDATA stuff are handled automatically by SQLX (XML functionality integrated into Oracle's SQL)
-
Question to load data using sql loader in staging table, and then in the main tables!
Hello
I'm trying to load data into our main database table using SQL LOADER. data will be provided in separate pipes csv files.
I have develop a shell script to load the data and it works fine except one thing.
Here are the details of a data to re-create the problem.
Staging of the structure of the table in which data will be filled using sql loader
create table stg_cmts_data (cmts_token varchar2 (30), CMTS_IP varchar2 (20));
create table stg_link_data (dhcp_token varchar2 (30), cmts_to_add varchar2 (200));
create table stg_dhcp_data (dhcp_token varchar2 (30), DHCP_IP varchar2 (20));
DATA in the csv file-
for stg_cmts_data-
cmts_map_03092015_1.csv
WNLB-CMTS-01-1. 10.15.0.1
WNLB-CMTS-02-2 | 10.15.16.1
WNLB-CMTS-03-3. 10.15.48.1
WNLB-CMTS-04-4. 10.15.80.1
WNLB-CMTS-05-5. 10.15.96.1
for stg_dhcp_data-
dhcp_map_03092015_1.csv
DHCP-1-1-1. 10.25.23.10, 25.26.14.01
DHCP-1-1-2. 56.25.111.25, 100.25.2.01
DHCP-1-1-3. 25.255.3.01, 89.20.147.258
DHCP-1-1-4. 10.25.26.36, 200.32.58.69
DHCP-1-1-5 | 80.25.47.369, 60.258.14.10
for stg_link_data
cmts_dhcp_link_map_0309151623_1.csv
DHCP-1-1-1. WNLB-CMTS-01-1,WNLB-CMTS-02-2
DHCP-1-1-2. WNLB-CMTS-03-3,WNLB-CMTS-04-4,WNLB-CMTS-05-5
DHCP-1-1-3. WNLB-CMTS-01-1
DHCP-1-1-4. WNLB-CMTS-05-8,WNLB-CMTS-05-6,WNLB-CMTS-05-0,WNLB-CMTS-03-3
DHCP-1-1-5 | WNLB-CMTS-02-2,WNLB-CMTS-04-4,WNLB-CMTS-05-7
WNLB-DHCP-1-13 | WNLB-CMTS-02-2
Now, after loading these data in the staging of table I have to fill the main database table
create table subntwk (subntwk_nm varchar2 (20), subntwk_ip varchar2 (30));
create table link (link_nm varchar2 (50));
SQL scripts that I created to load data is like.
coil load_cmts.log
Set serveroutput on
DECLARE
CURSOR c_stg_cmts IS SELECT *.
OF stg_cmts_data;
TYPE t_stg_cmts IS TABLE OF stg_cmts_data % ROWTYPE INDEX BY pls_integer;
l_stg_cmts t_stg_cmts;
l_cmts_cnt NUMBER;
l_cnt NUMBER;
NUMBER of l_cnt_1;
BEGIN
OPEN c_stg_cmts.
Get the c_stg_cmts COLLECT in BULK IN l_stg_cmts;
BECAUSE me IN l_stg_cmts. FIRST... l_stg_cmts. LAST
LOOP
SELECT COUNT (1)
IN l_cmts_cnt
OF subntwk
WHERE subntwk_nm = l_stg_cmts (i) .cmts_token;
IF l_cmts_cnt < 1 THEN
INSERT
IN SUBNTWK
(
subntwk_nm
)
VALUES
(
l_stg_cmts (i) .cmts_token
);
DBMS_OUTPUT. Put_line ("token has been added: ' |") l_stg_cmts (i) .cmts_token);
ON THE OTHER
DBMS_OUTPUT. Put_line ("token is already present'");
END IF;
WHEN l_stg_cmts EXIT. COUNT = 0;
END LOOP;
commit;
EXCEPTION
WHILE OTHERS THEN
Dbms_output.put_line ('ERROR' |) SQLERRM);
END;
/
output
for dhcp
coil load_dhcp.log
Set serveroutput on
DECLARE
CURSOR c_stg_dhcp IS SELECT *.
OF stg_dhcp_data;
TYPE t_stg_dhcp IS TABLE OF stg_dhcp_data % ROWTYPE INDEX BY pls_integer;
l_stg_dhcp t_stg_dhcp;
l_dhcp_cnt NUMBER;
l_cnt NUMBER;
NUMBER of l_cnt_1;
BEGIN
OPEN c_stg_dhcp.
Get the c_stg_dhcp COLLECT in BULK IN l_stg_dhcp;
BECAUSE me IN l_stg_dhcp. FIRST... l_stg_dhcp. LAST
LOOP
SELECT COUNT (1)
IN l_dhcp_cnt
OF subntwk
WHERE subntwk_nm = l_stg_dhcp (i) .dhcp_token;
IF l_dhcp_cnt < 1 THEN
INSERT
IN SUBNTWK
(
subntwk_nm
)
VALUES
(
l_stg_dhcp (i) .dhcp_token
);
DBMS_OUTPUT. Put_line ("token has been added: ' |") l_stg_dhcp (i) .dhcp_token);
ON THE OTHER
DBMS_OUTPUT. Put_line ("token is already present'");
END IF;
WHEN l_stg_dhcp EXIT. COUNT = 0;
END LOOP;
commit;
EXCEPTION
WHILE OTHERS THEN
Dbms_output.put_line ('ERROR' |) SQLERRM);
END;
/
output
for link -.
coil load_link.log
Set serveroutput on
DECLARE
l_cmts_1 VARCHAR2 (4000 CHAR);
l_cmts_add VARCHAR2 (200 CHAR);
l_dhcp_cnt NUMBER;
l_cmts_cnt NUMBER;
l_link_cnt NUMBER;
l_add_link_nm VARCHAR2 (200 CHAR);
BEGIN
FOR (IN) r
SELECT dhcp_token, cmts_to_add | ',' cmts_add
OF stg_link_data
)
LOOP
l_cmts_1: = r.cmts_add;
l_cmts_add: = TRIM (SUBSTR (l_cmts_1, 1, INSTR (l_cmts_1, ',') - 1));
SELECT COUNT (1)
IN l_dhcp_cnt
OF subntwk
WHERE subntwk_nm = r.dhcp_token;
IF l_dhcp_cnt = 0 THEN
DBMS_OUTPUT. Put_line ("device not found: ' |") r.dhcp_token);
ON THE OTHER
While l_cmts_add IS NOT NULL
LOOP
l_add_link_nm: = r.dhcp_token |' _TO_' | l_cmts_add;
SELECT COUNT (1)
IN l_cmts_cnt
OF subntwk
WHERE subntwk_nm = TRIM (l_cmts_add);
SELECT COUNT (1)
IN l_link_cnt
LINK
WHERE link_nm = l_add_link_nm;
IF l_cmts_cnt > 0 AND l_link_cnt = 0 THEN
INSERT INTO link (link_nm)
VALUES (l_add_link_nm);
DBMS_OUTPUT. Put_line (l_add_link_nm |) » '||' Has been added. ") ;
ELSIF l_link_cnt > 0 THEN
DBMS_OUTPUT. Put_line (' link is already present: ' | l_add_link_nm);
ELSIF l_cmts_cnt = 0 then
DBMS_OUTPUT. Put_line (' no. CMTS FOUND for device to create the link: ' | l_cmts_add);
END IF;
l_cmts_1: = TRIM (SUBSTR (l_cmts_1, INSTR (l_cmts_1, ',') + 1));
l_cmts_add: = TRIM (SUBSTR (l_cmts_1, 1, INSTR (l_cmts_1, ',') - 1));
END LOOP;
END IF;
END LOOP;
COMMIT;
EXCEPTION
WHILE OTHERS THEN
Dbms_output.put_line ('ERROR' |) SQLERRM);
END;
/
output
control files -
DOWNLOAD THE DATA
INFILE 'cmts_data.csv '.
ADD
IN THE STG_CMTS_DATA TABLE
When (cmts_token! = ") AND (cmts_token! = 'NULL') AND (cmts_token! = 'null')
and (cmts_ip! = ") AND (cmts_ip! = 'NULL') AND (cmts_ip! = 'null')
FIELDS TERMINATED BY ' |' SURROUNDED OF POSSIBLY "" "
TRAILING NULLCOLS
('RTRIM (LTRIM (:cmts_token))' cmts_token,
cmts_ip ' RTRIM (LTRIM(:cmts_ip)) ")". "
for dhcp.
DOWNLOAD THE DATA
INFILE 'dhcp_data.csv '.
ADD
IN THE STG_DHCP_DATA TABLE
When (dhcp_token! = ") AND (dhcp_token! = 'NULL') AND (dhcp_token! = 'null')
and (dhcp_ip! = ") AND (dhcp_ip! = 'NULL') AND (dhcp_ip! = 'null')
FIELDS TERMINATED BY ' |' SURROUNDED OF POSSIBLY "" "
TRAILING NULLCOLS
('RTRIM (LTRIM (:dhcp_token))' dhcp_token,
dhcp_ip ' RTRIM (LTRIM(:dhcp_ip)) ")". "
for link -.
DOWNLOAD THE DATA
INFILE 'link_data.csv '.
ADD
IN THE STG_LINK_DATA TABLE
When (dhcp_token! = ") AND (dhcp_token! = 'NULL') AND (dhcp_token! = 'null')
and (cmts_to_add! = ") AND (cmts_to_add! = 'NULL') AND (cmts_to_add! = 'null')
FIELDS TERMINATED BY ' |' SURROUNDED OF POSSIBLY "" "
TRAILING NULLCOLS
('RTRIM (LTRIM (:dhcp_token))' dhcp_token,
cmts_to_add TANK (4000) RTRIM (LTRIM(:cmts_to_add)) ")" ""
SHELL SCRIPT-
If [!-d / log]
then
Mkdir log
FI
If [!-d / finished]
then
mkdir makes
FI
If [!-d / bad]
then
bad mkdir
FI
nohup time sqlldr username/password@SID CONTROL = load_cmts_data.ctl LOG = log/ldr_cmts_data.log = log/ldr_cmts_data.bad DISCARD log/ldr_cmts_data.reject ERRORS = BAD = 100000 LIVE = TRUE PARALLEL = TRUE &
nohup time username/password@SID @load_cmts.sql
nohup time sqlldr username/password@SID CONTROL = load_dhcp_data.ctl LOG = log/ldr_dhcp_data.log = log/ldr_dhcp_data.bad DISCARD log/ldr_dhcp_data.reject ERRORS = BAD = 100000 LIVE = TRUE PARALLEL = TRUE &
time nohup sqlplus username/password@SID @load_dhcp.sql
nohup time sqlldr username/password@SID CONTROL = load_link_data.ctl LOG = log/ldr_link_data.log = log/ldr_link_data.bad DISCARD log/ldr_link_data.reject ERRORS = BAD = 100000 LIVE = TRUE PARALLEL = TRUE &
time nohup sqlplus username/password@SID @load_link.sql
MV *.log. / log
If the problem I encounter is here for loading data in the link table that I check if DHCP is present in the subntwk table, then continue to another mistake of the newspaper. If CMTS then left create link to another error in the newspaper.
Now that we can here multiple CMTS are associated with unique DHCP.
So here in the table links to create the link, but for the last iteration of the loop, where I get separated by commas separate CMTS table stg_link_data it gives me log as not found CMTS.
for example
DHCP-1-1-1. WNLB-CMTS-01-1,WNLB-CMTS-02-2
Here, I guess to link the dhcp-1-1-1 with balancing-CMTS-01-1 and wnlb-CMTS-02-2
Theses all the data present in the subntwk table, but still it gives me journal wnlb-CMTS-02-2 could not be FOUND, but we have already loaded into the subntwk table.
same thing is happening with all the CMTS table stg_link_data who are in the last (I think here you got what I'm trying to explain).
But when I run the SQL scripts in the SQL Developer separately then it inserts all valid links in the table of links.
Here, she should create 9 lines in the table of links, whereas now he creates only 5 rows.
I use COMMIT in my script also but it only does not help me.
Run these scripts in your machine let me know if you also get the same behavior I get.
and please give me a solution I tried many thing from yesterday, but it's always the same.
It is the table of link log
link is already present: dhcp-1-1-1_TO_wnlb-cmts-01-1 NOT FOUND CMTS for device to create the link: wnlb-CMTS-02-2
link is already present: dhcp-1-1-2_TO_wnlb-cmts-03-3 link is already present: dhcp-1-1-2_TO_wnlb-cmts-04-4 NOT FOUND CMTS for device to create the link: wnlb-CMTS-05-5
NOT FOUND CMTS for device to create the link: wnlb-CMTS-01-1
NOT FOUND CMTS for device to create the link: wnlb-CMTS-05-8 NOT FOUND CMTS for device to create the link: wnlb-CMTS-05-6 NOT FOUND CMTS for device to create the link: wnlb-CMTS-05-0 NOT FOUND CMTS for device to create the link: wnlb-CMTS-03-3
link is already present: dhcp-1-1-5_TO_wnlb-cmts-02-2 link is already present: dhcp-1-1-5_TO_wnlb-cmts-04-4 NOT FOUND CMTS for device to create the link: wnlb-CMTS-05-7
Device not found: wnlb-dhcp-1-13 IF NEED MORE INFORMATION PLEASE LET ME KNOW
Thank you
I felt later in the night that during the loading in the staging table using UNIX machine he created the new line for each line. That is why the last CMTS is not found, for this I use the UNIX 2 BACK conversion and it starts to work perfectly.
It was the dos2unix error!
Thank you all for your interest and I may learn new things, as I have almost 10 months of experience in (PLSQL, SQL)
-
Select table_name dynamic pl/sql variable - possible?
Hello
With the help of 11.2.0.3
Select count (*)
in v_cnt
products
example, but when we do not know the name of the table until the runtime, for example table pl/sql package is their < sysdate > produits_
Is it possible to use sql dyanamic for this instructions below does not work
Select count (*)
in v_cnt
of < dyanmic_table_name >
If so, how?
Thank you
Hello
try something like this
create or replace function fn_count_rows ( table_in in varchar ) return number is number_of_rows number; begin execute immediate 'select count(*) from ' || table_in into number_of_rows; return number_of_rows; end; /
concerning
Kay -
Display all the months in a year using sql
Hello
Hi guys I need to generate all the months in a year as
January
February
.
.
.
.
.
December
I need to use this function,
so do me a query to generate months
Thanks in advance
Select to_char (to_date(level,'mm'), 'fmMonth') month
of the double
connect by level<=>=>
/
MONTH
---------
January
February
March
April
May
June
July
August
September
October
NovemberMONTH
---------
December12 selected lines.
SQL >
SY.
-
Building xml in oracle without unnecessary tags using sql
I wanted to build XML in oracle using sql, I found a way to construction using sql functions after a little research, I am completely unaware of any XML. My query is
SELECT XMLELEMENT("orderwave",
XMLAGG(XMLELEMENT("order_header",
-- XMLATTRIBUTES(t2.l_name AS "order_number"),
XMLFOREST(
nvl(t2.l_name,' ') as "order_number",
(
SELECT XMLAGG(XMLELEMENT("order_line",
XMLFOREST( nvl(t1.l_name,' ') AS "label_type",
nvl(t1.l_num,0) AS "lpn",
nvl(t1.l_num,0) AS "sku"
)
)
)
FROM test_table t1
WHERE UPPER(t1.record_type)='D'
) AS sap
)
)
)
) AS HEADER
FROM test_table t2
WHERE UPPER(t2.record_type) ='H';My problem is for using xmlforest, I had to use alias name 'sap' in my query to work and to get xml output. If i am using that, I am getting an unwanted tag 'SAP' around my data which I have to later cut it, which is unacceptable. Is there a way I can get rid of this extra 'SAP' tag without having to cut. The output data is
<orderwave>
<order_header>
<order_number>order1</order_number>
<SAP>
<order_line>
<label_type>test1</label_type>
<lpn>1</lpn>
<sku>1</sku>
</order_line>
<order_line>
<label_type>test2</label_type>
<lpn>2</lpn>
<sku>2</sku>
</order_line>
<order_line>
<label_type />
<lpn>0</lpn>
<sku>0</sku>
</order_line>
</SAP>
</order_header>
<order_header>
<order_number>order2</order_number>
<SAP>
<order_line>
<label_type>test1</label_type>
<lpn>1</lpn>
<sku>1</sku>
</order_line>
<order_line>
<label_type>test2</label_type>
<lpn>2</lpn>
<sku>2</sku>
</order_line>
<order_line>
<label_type />
<lpn>0</lpn>
<sku>0</sku>
</order_line>
</SAP>
</order_header>
</orderwave>Any help is really appreciated and thanks in advance.
-- sample data with test_table as ( select 'H' record_type, 'order1' l_name, 0 l_num from dual union all select 'H' record_type, 'order2' l_name, 0 l_num from dual union all select 'D' record_type, 'test1' l_name, 1 l_num from dual union all select 'D' record_type, 'test2' l_name, 2 l_num from dual ) -- end of sample data select xmlelement ( "order_wave" , xmlagg ( xmlelement ( "order_header" , xmlelement("order_number", t1.l_name) , xmlagg ( xmlelement ( "order_line" , xmlelement("label_type", t2.l_name) , xmlelement("lpn", t2.l_num) , xmlelement("sku", t2.l_num) ) ) ) ) ) xml_data from test_table t1 cross join test_table t2 where t1.record_type = 'H' and t2.record_type = 'D' group by t1.l_name; -- output /*
order1 test1 1 1 test2 2 2 order2 test1 1 1 test2 2 2 -
How to get the full DDL using SQL developer
Hi all
I need get the full DDL a table with the details of the index partitions, synonyms, comments (if any) and give information if given any role, use SQL developer. We can achieve the same thing using shortcut F4 on name of the table into a frog, then selecting tab DDL. Is it possible to get the same in SQL Developer also?
Also how I see existing procedures using SQL developer? A toad, we were able to achieve using the schema browser.
Hi all
I reached by - right click on connection - diagram open... and any browser will even...
-
MySQL->; table using SQL Developer Oracle
Greetings,
Currently, I am a (student) temporary employee who is responsible for the migration of the MySQL database of a company to their new (gr 11, 2) Oracle database.
So far, I use SQL Developer, because I learned a few minor techniques with this application.
I have tried different methods for the migration, including those of the Oracle (Migration of MySQL) page
I however got no positive results with most of the methods.
-J' have established a connection to the MySQL database Oracle database aswell, within SQL Developer
Now, so far, I've copied manually (right click on the table, copy to Oracle) 90% of the tables from the MySQL to Oracle database successfully.
However, these tables contain only about 5% of the data. The problem is in the 2 tables that actually have a decent amount of records.
FOR INFO:
File 1: 75MB file .csv, ~150.000 records (individual records contain all select queries, where the size)
File 02:50 MB of files .csv, ~2.200.000 records
My previous attempts to use the same copy for Oracle option to right click on one of the two largest tables resulted in the following error:
The table of queries down. Message: java.io.IOException: IO error: socket read timed out
My first action to prevent this error has been to add a second file data to the current storage space, giving it 200M maxsize.
Okay it's coming, my real questions!
This could be a possible solution to avoid the error mentioned earlier to return?
What other issues are possible in case of failure?
Uses an external table to a faster and more effective method?
(The reason for which I have not yet tried external tables is because I had no SYS (TEM) privileges, so anything that requires privileges, I first have to discuss with my superior).
Any help is appreciated! Although my next answer is maybe not earlier that come Monday 17.
Welcome, Brent
Hello
I just discovered there is a csv Import Wizard in sqldeveloper also - don't know if you tried?
tables in the destination database (oracle) - right-click and choose Import data - this will bring you in a Wizard of csv.
However, I think that due to the volumes of data it may have similar problems.
sqlldr is probably your best choice - it's pretty simple once you find a decent example - it seems to cover the basics of ok - Oracle SQL Stuff (for example): SQL-Loader: the tutorial step by step - example 1 (CSV file)
See you soon,.
Rich
-
Error loading data using SQL loader
I get an error message like "SQL * Loader - 350 combination illegal syntax of non-alphanumeriques characters error during loading of a file using SQL loader in RHEL." The command used to run SQL * Loader is:
Sqlldr userid = < user name > / < password > control = data.ctl
The control file is data.ctl:
DOWNLOAD the data
INFILE ' / home/oraprod/data.txt'
Add in the table test
{
EmpID completed by «,»,
fname completed by «,»,
lname completed by «,»,
treatment is completed with a white space
}
The data.txt file is:
1, Kaushal, Hamad, 5000
2, Chetan, Hamad, 1000
Hopefully, my question is clear.
Please get back with the answer to my query.
Concerning
Replace "{" by "("dans votre fichier de contrôle) "
DOWNLOAD the data
INFILE 'c:\data.txt.
Add the emp_t table
(
EmpID completed by «,»,
fname completed by «,»,
lname completed by «,»,
treatment is completed with a white space
)
C:\>sqlldr user/pwd@database control = c.ctl
SQL * Loader: release 10.2.0.3.0 - Production on Wed Nov 13 10:10:24 2013
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Commit the point reached - the number of logical records 1
Commit the point reached - the number of logical records 2
SQL > select * from emp_t;
EMPID, FNAME LNAME SALARY
---------- -------------------- -------------------- ----------
1 kone hamadi 5000
2 Chetan Hamad 1000
Best regards
Mohamed Houri
-
Demonstrating the PL/SQL using SQL Developer functions
Good afternoon
I started writing some PL/SQL functions to replace some of the SQL I use most often. Some very simple examples would be:
create or replace function func_test (p_1 number) return number is x number; y number; begin x :=1; y :=2; return p_1 * x * y; end func_test;
create or replace function func_test2 (p_1 varchar2) return varchar2 is return_val varchar2(10); begin select p_1 into return_val from dual; return return_val; end func_test2;
However, on my place of work that I have not been granted created function privileges again until I can show some examples, which is understandable.
For the moment, without these privileges, is there a way I can build/test functions in principle locally using SQL Developer without the need to write functions in our database? I.e. can demonstrate meanings in SQL Developer, but devoid of envelope to create or syntax of replace?
I hope that's not too vague.
Using Oracle 11 g 2 (not connected to the database of the workplace at this time for a specific version not.)
3.4 SQL Developer
Thank you
TP
Hello
The obvious solution is to get privileges. If your employer wants to do you something, they give you the necessary privileges to do so. It's silly for them to tell you to do something, but refuses to let you do.
Otherwise, you can install Oracle on your own machine, as suggested above. It's free and legitimate, if you only use it for learning and development. Oracle Express Edition is very easy to install.
As a last resort, you can write functions and procedures that are local to an anonymous block, like this:
SET SERVEROUTPUT ON
DECLARE
Function func_test (p_1 number) return number
is
x number;
number of y;
Start
x: = 1;
y: = 2;
return p_1 * x y;
end func_test;
BEGIN
dbms_output.put_line (func_test (3))
|| '= func_test results.
);
END;
/You can only call this kind of function of the anonymous block in which it is defined.
-
Use SQL to write SQL in sqldeveloepr
Is there a slick way to use SQL to write SQL in sqldeveloper? This would entail the release of a statement SQL SELECT, which, after all, is just sitting there in the window exit, ready to run running. Or am I pretty much stuck to writing for the hold file and then execute it?Hello
You may be using a version of SQL Developer prior to 2.1. Using 2.1 or higher, the toolbar of the Output of the Script tab contains an icon to the output of the Script run as a Script that opens a new spreadsheet and copy the output of the script to run inside.
Kind regards
Gary -
Get each end calendar month using SQL date
Hi guys,.
How to get the each month end date using SQL Script?
Ex: If the effective date is January 15, 2011, then the date will be January 31, 2011.
can someone help me get this result?
TIA,Hello
I think that below query is useful for you.Select last_day (Your_Date) of double;
Kind regards
Fame -
How to view this calendar of the current month using SQL code
Hello
I have a problem with the creation of a timetable for this month. Without any pl/sql program. Only by using sql.
Please help me... !!
Concerning
EvelyneHello
Try this... It works...: D
with x as ( select * from ( select to_char(trunc(sysdate,'mm')+level-1,'iw') wk, to_char(trunc(sysdate,'mm')+level-1,'dd') dm, to_number(to_char(trunc(sysdate,'mm')+level-1,'d')) dw, to_char(trunc(sysdate,'mm')+level-1,'mm') curr_mth, to_char(sysdate,'mm') mth from dual connect by level <= 31 ) where curr_mth = mth ) select max(case dw when 2 then dm end) Mo, max(case dw when 3 then dm end) Tu, max(case dw when 4 then dm end) We, max(case dw when 5 then dm end) Th, max(case dw when 6 then dm end) Fr, max(case dw when 7 then dm end) Sa, max(case dw when 1 then dm end) Su from x group by wk order by wk
concerning
K
Maybe you are looking for
-
Failed to open the particular folder in ThunderBird - v38.3.0
Hi all I always get the error messages below when opening a particular file in my mailbox. "Cannot open file daily reports Mails because it is used by another operation. Please wait for this operation to the end, and then select the folder again. » E
-
Overnight battery discharged when the satellite has been turned off
Hello This has happened again. My battery empties 25% from one day to the next and will be completely discharged in a week. The machine is not in hibernation, it is completely shut down. If I charge the battery and remove it from the machine it does
-
ENDURANCE mode turns off display
Hello I got my Z2 a little over a week ago and I noticed that when I have the STAMINA mode on my screen keeps expire every 5 seconds despite the settings being during 5 minutes. No one knows what it is and how to fix it. Thank you
-
Type1fonts will not be displayed in Adovè CS3 programs. * Photoshop, Illustrator, and Indesign are the main programs I have problems with.* Just upgraded to Windows 7* Having .pfm file types as required for Type1 fonts .pfb* The fonts work in Notepad
-
Eclipse plugin 1.0.0.67 problems with Bitmap.getBitmapResource
I upgraded to 1.0.0.67, and now Bitmap.getBitmapResource is unable to find the png files. Everything else on the project seems to be the same. Any ideas what's happening here?