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)
Related
I am attempting to correlate two databases together with the following query:
SELECT AE.EventTimeStamp, AE.SourceName, AE.Message, AE.Severity, AE.GroupPath
FROM FTAE_History.dbo.AllEvent AE
JOIN BatchHistoryEx.dbo.SequenceActiveUnit ActiveUnits
ON #RecipeName = ActiveUnits.SequenceName
AND ActiveUnits.ActiveUnit like (CONCAT('%',RIGHT(AE.GroupPath,CHARINDEX('.',REVERSE(AE.GroupPath))-1),'%'))
WHERE AE.EventTimeStamp between #StartTime_UTC and #EndTime_UTC
AND LEN(AE.GroupPath) > 13
AND AE.Active = 1
AND AE.Severity >= 500
ORDER BY EventTimeStamp
When run in SQL Management Studio, I can execute on any #RecipeName or #StartTime_UTC/#EndTime_UTC. When I embed this query in an SSRS dataset, some #RecipeName's or times throw this error:
An error has occurred during report processing. (rsProcessingAborted)
Query execution failed for dataset 'GetUniqueID_BatchIDForAlarms'. (rsErrorExecutingCommand)
An expression of non-boolean type specified in a context where a condition is expected, near ','.
The error is happening inside the JOIN statement - when I remove that block all possible parameters entered execute even in SSRS. What is causing the difference? How best do I implement an error handling system to allow this query to execute without exceptions?
UPDATE ASSIGNMENTS SET CBTURL = REPLACE(CBTURL, 'http://172.21.130.19/', 'https://testlpsweb.corp.mbll.ca/Content/')
The above statement produces "Data truncation" error. Please advise why and how to correct it.
Error starting at line : 1 in command - UPDATE ASSIGNMENTS SET CBTURL = REPLACE(CBTURL, 'http://172.21.130.19/', 'https://testlpsweb.corp.mbll.ca/Content/') Error at Command Line : 1 Column : 1 Error report - SQL Error: Data truncation
I'm guessing that CBTURL column length is to small for resulting string of replace. Could you try to alter column to have larger lenght.
Try this query to see maximum resulst string lenght:
Select Max(Len(REPLACE(CBTURL, 'http://172.21.130.19/', 'https://testlpsweb.corp.mbll.ca/Content/'))) from tablename ....
I am using only two columns 1.name 2.field. i need to retrieve name where field is =? how to specify.i dont want this--> (self.topic_space,)) i need the second column.so where to put the comma
Here is my code :
cur.execute("SELECT name FROM developers_info WHERE field=?",(,self.topic_space))
File "administrator.py", line 19
cur.execute("SELECT * FROM developers_info WHERE field=?",(,self.topic_space))
^
Here is my error :
SyntaxError: invalid syntax
It looks like you may have a rogue comma. Try this
cur.execute("SELECT name FROM developers_info WHERE field=?",(self.topic_space))
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?
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.