CREATE VIEW bd_nearest_hy AS
SELECT b1.b_name, h1.h_id
FROM building b1,hydrant h1
WHERE sdo_nn(h1.shape, b1.shape,'sdo_num_res = 1') = 'TRUE';
SELECT bd_nearest_hy.b_name
FROM bd_nearest_hy
WHERE bd_nearest_hy.h_id = 'p30';
I created a view, which is used to store the building name and its corresponding nearest hydrant. The sdo_nn statement works fine and the view is correct.
However, when I select the row contains h_id = p30 from the view, the database says:
Error report:
SQL Error: ORA-13249: SDO_NN cannot be evaluated without using index
ORA-06512: at "MDSYS.MD", line 1723
ORA-06512: at "MDSYS.MDERR", line 17
ORA-06512: at "MDSYS.PRVT_IDX", line 9
What's wrong with it?
Related
I have the following table schema prepared by AWS glue
When I query the table using SELECT * FROM "vietnam-property-develop"."sell" limit 10;, it throws an error:
HIVE_BAD_DATA: Error parsing field value '{"area":"85
m²","date":"14/01/2020","datetime":"2020-01-18
00:42:28.488576+00:00","address":"Quan Hoa - Cầu Giấy","price":"20
Tỷ","cat":"Bán nhà mặt
phố","lon":"105.7976502","avatar":"","id":"24169794","title":"Chính
chủ cần bán nhà mặt phố nguyễn văn huyên Quan Hoa Cầu Giấy, 2 tầng, dt
85m2. LH 0903233723","lat":"21.0376771","room":"0"}' for field 4:
org.openx.data.jsonserde.json.JSONObject cannot be cast to
java.lang.Double
Then I tired to just query the title column by using SELECT title FROM "vietnam-property-develop"."sell" limit 10;
It returns result which I didn't expect. It seems that the query return the whole json files instead of just the title column. And the number of rows is 4 but not 10 no matter how I modify the query.
I am trying to run the model in R software which calls functions from GRASS GIS (version 7.0.2) and PostgreSQL (version 9.5) to complete the task. I have created a database in PostgreSQL and created an extension Postgis, then imported required vector layers into the database using Postgis shapefile importer. Every time I try to run using R (run as an administrator), it returns an error like:
Error in fetch(dbSendQuery(con, q, n = -1)) :
error in evaluating the argument 'res' in selecting a method for function 'fetch': Error in postgresqlExecStatement(conn, statement, ...) :
RS-DBI driver: (could not Retrieve the result : ERROR: column mm.geom does not exist
LINE 5: (st_dump(st_intersection(r.geom, mm.geom))).geom as geom,
^
HINT: Perhaps you meant to reference the column "r.geom".
QUERY:
insert into m_rays
with os as (
select r.ray, st_endpoint(r.geom) as s,
(st_dump(st_intersection(r.geom, mm.geom))).geom as geom,
mm.legend, mm.hgt as hgt, r.totlen
from rays as r,bh_gd_ne_clip as mm
where st_intersects(r.geom, mm.geom)
)
select os.ray, os.geom, os.hgt, l.absorb, l.barrier, os.totlen,
st_length(os.geom) as shape_length, st_distance(os.s, st_endpoint(os.geom)) as near_dist
from os left join lut as l
on os.legend = l.legend
CONTEXT: PL/pgSQL function do_crtn(text,text,text) line 30 at EXECUTE
I have checked over and over again, column geometry does exist in Schema>Public>Views of PostgreSQL. Any advise on how to resolve this error?
add quotes and then use r."geom" instead r.geom
I created a view and then I want to update the cost and show the error. But it reterns that virtual column not allowed.
View:
CREATE OR REPLACE VIEW CONCERT_EVENTS1 AS
SELECT CONCERT.CONCERT_ID, EVENT.EVENT_ID, CONCERT.NAME, EVENT.DATE1 , CONCERT.DURATION,
CONCERT.TYPE, TO_CHAR(CONCERT.COST, 'L9,999.99') AS FORMATED_COST
FROM EVENT
INNER JOIN CONCERT
ON CONCERT.CONCERT_ID = EVENT.CONCERT_ID;
Below is the error:
Error starting at line 1 in command:
UPDATE CONCERT_EVENTS1
SET formated_cost = '300.00'
WHERE formated_cost = '200.00'
Error at Command Line:2 Column:5
Error report:
SQL Error: ORA-01733: virtual column not allowed here
01733. 00000 - "virtual column not allowed here"
*Cause:
*Action:
Thanks in advance
FORMATED_COST is probably a calculated field, or in any case the
database cannot infer what change is to be made to the tables
underlying the view based on the change you are requiring.
Include an extra column in your view on CONCERT.COST without the formatting. And update only that new column. The explanation of why this is needed is given by Vignesh Kumar.
I need to reject the rows from an external table which starts (first column of every row) with some special characters (eg. ~ \ etc) in a CSV file.
For that I have used LOAD WHEN clause in the ACCESS PARAMETERS clause. I have been using the following statement in the Access parameters clause:
load when (1:1) != '~'
But it throws an error stating "INVALID CHARACTER"
If I try to use the below statement,
load when (empname != '~empname')
It throws:
ERROR at line 1:
ORA-29913: error in executing ODCIEXTTABLEFETCH callout
ORA-06512: at "SYSTEM.EMP_PROCEDURE", line 101
ORA-06512: at line 1
Line 101 in the procedure is select * from emp;
How do I use LOAD WHEN clause - any examples?
You could use this:
LOAD WHEN (1:1) != 0x'7e'
Reference: http://download.oracle.com/docs/cd/E11882_01/server.112/e16536/et_params.htm#i1009513
Have you tried using the ASCII value of a tilde?
load when (1:1) != CHR(126)
I'm trying to form a query that returns a list of entities within a given rectangle, using SDO_WITHIN_DISTANCE. The query I've made seems like it should work, but Oracle is giving me some strange errors. Here's the query:
SELECT *
FROM TBLENTITYLOCATION TL
INNER JOIN TBLENTITY TE
ON TE.ENTITYID=TL.ENTITYID
WHERE SDO_WITHIN_DISTANCE (TL.GEOLOCATION
, SDO_GEOMETRY (2003
, NULL
, NULL
, SDO_ELEM_INFO_ARRAY(1, 1003, 3)
, SDO_ORDINATE_ARRAY(41, -73, 36, -82)
), 'DISTANCE=10 UNIT=M'
) = 'TRUE'
AND TL.LOCATIONDATETIME= (select MAX(LOCATIONDATETIME)
FROM TBLENTITYLOCATION
WHERE ENTITYID = TE.ENTITYID)
The error is as follows:
ORA-29902: error in executing ODCIIndexStart() routine
ORA-13208: internal error while evaluating [window SRID does not match layer SRID] operator
ORA-06512: at MDSYS.SDO_INDEX_METHOD_10I", line 286
OERR says:
29902. 00000 - "error in executing ODCIIndexStart() routine"
*Cause: The execution of ODCIIndexStart routine caused an error.
*Action: Examine the error messages produced by the indextype code and take appropriate action.
Thanks for any help or ideas.
The ORA-13208 error is the prime one here.
The TL.GEOLOCATION needs a matching value in the SRID (second parameter of the SDO_GEOMETRY)
See if the response here helps you out.
Gary Myers provided correct answer, let me augment it. If you don't know which SRID is used by your table, do a query:
select SRID from USER_SDO_GEOM_METADATA where TABLE_NAME='TBLENTITYLOCATION' and COLUMN_NAME='TBLENTITYLOCATION'
Also, to query for objects which are within a rectangle, you don't need SDO_WITHIN_DISTANCE operator. Instead, use SDO_RELATE with mask=ANYINTERACT. See http://docs.oracle.com/cd/B12037_01/appdev.101/b10826/sdo_operat.htm#i78531 for more details.