So I have a webapp that takes in a string where ID elements are broken up by '-' (e.g. someid1-someid2). I then convert the string to something like someid1 OR someid2. This in theory according to Oracle's doc's should allow me to then do something like
SELECT somecol1, somecol2 FROM sometable WHERE CONTAINS (somecol1, 'someid1 OR someid2') > 0;
However I'm getting the following error when running the sample query in SQL Dev:
ORA-00904: "CONTAINS": invalid identifier
00904. 00000 - "%s: invalid identifier"
*Cause:
*Action:
The version of Oracle is Oracle9i Enterprise Edition Release 9.2.0.5.0 - Production of which the documentation is for, so I don't see why CONTAINS would be considered an invalid identifier. Adding the other optional parameter
SELECT somecol1, somecol2 FROM sometable WHERE CONTAINS (somecol1, 'someid1 OR someid2', 1) > 0;
also gives the same error. What am I/it doing wrong here?
EDIT:
'Working Code' as per request although arguably it isn't working
SELECT tech, product FROM tech_det_view WHERE CONTAINS (tech, 'test OR qual') > 0;
You should create oracle text index before using CONTAINS function
CREATE INDEX idxName ON tableName(columnName) INDEXTYPE IS CTXSYS.CONTEXT;
Here you can find more information about Oracle Text.
Related
c.execute('select *
from IQMS.work_center,
IQMS.TA_labor
where work_center.ID = TA_labor.WORK_CENTER_ID
and TA_labor.CUSER1 = %s'% hostname)
the same above command I am able to run and get the output in SQL Developer.
Please help me in this
I need help with the following.
I have a table which has one of the columns as type BLOB. Executing following query allows me to read the BLOB in the Oracle SQL developor's text editor as the image below:
select
utl_raw.cast_to_varchar2(utl_compress.lz_uncompress(a.DATA))
from my_table a where a.id = 11266392;
I can double click on above shaded cell and read it in text. This is nice but it only works for one row at a time. My actual goal is to read specific data within xml tags from each of these BLOBs and there are roughly a million of those for each month.
I thought i could cast this into a string and read the first 4000 characters but that was useless as my BLOBs for each record are of length 400K (using getlength procedure from dbms_lob).
I tried casting the blob in XML via this
select CONVERT(xml,a.data, 2) from
(select utl_compress.lz_uncompress(a.DATA) as data from my_table a where a.id = 11266392) a;
But this threw an error:
ORA-00904: "XML": invalid identifier
00904. 00000 - "%s: invalid identifier"
*Cause:
*Action:
Error at Line: 10 Column: 16
My question is then, is there a way I can use extract XML, XQuery or XMLTable on the blob itself (after I have applied the lz_uncompress function on it)?
What are my other alternatives?
Here is the heavily edited XML in one of the blob (note that I have about 10-15 such Worksheet tags)
<Worksheets>
<Worksheet Description="Some Coverage" EffectiveDate="2020-06-28T00:01:00-05:00" ExpirationDate="2021-06-28T00:01:00-05:00" FixedId="Table:13263928">
<Routine RateBookCode="XX" RateBookEdition="00006" RoutineCode="XXX" RoutineVersion="1">
<Store Declaration="true" Result="false" ResultType="java.lang.Boolean" Variable="hasSpecialLimits">
<PropertyGet ObjectName="XXX" ObjectType="XXX" ObjectValue="My Address" PropertyName="HasSpecialLimits" Type="XXXXX" Value="false" ValueType="java.lang.Boolean"/>
</Store>
</Routine>
</Worksheet>
</Worksheets>
It should work like this:
SELECT XMLTYPE( a.data, 2 )
FROM ( select utl_compress.lz_uncompress(a.DATA) as data
from my_table a where a.id = 11266392 ) a;
After joining three tables, I am unable to call the column "shipping_id" from the "shipment" table.
I've tried re-ordering my joins and other ways of calling the column
SELECT shipment.shipping_id (date_of_delivery-order_date) AS "Length of Delivery",
damaged, inventory.product_id, name_of_product, price
FROM shipment
JOIN orders
ON orders.shipping_id = shipment.shipping_id
JOIN inventory
ON inventory.product_id = orders.product_id
If i remove the first SELECT entry "shipment.shipping_id", the query runs fine. I am receiving this error...
ORA-00904: "SHIPMENT"."SHIPPING_ID": invalid identifier
00904. 00000 - "%s: invalid identifier"
*Cause:
*Action:
Error at Line: 1 Column: 8
Missing comman after shipping_id. Since you're joining on shipping_id, there is no need to qualify the reference. There is only a single shipping_id column in the result.
I'm querying a DB2 table (STG_TOOL) with 2 columns - T_L_ID - Integer, Name - VARCHAR(20).
SELECT T_L_ID, Name FROM STG_TOOL;
The query returns answer. However, the below query gives error.
SELECT T_L_ID, RTRIM(Name) FROM STG_TOOL;
This query gives error at 78th row.
DB2 Database Error: ERROR [42815] [IBM][DB2] SQL0171N The data type,
length or value of the argument for the parameter in position "1" of
routine "SYSIBM.RTRIM" is incorrect. Parameter name: "". 1 0
The reason identified is that Name in 78th row has a replacement character - '�'.
Even, the same query with a where clause gives us the error.
SELECT T_L_ID, RTRIM(Name) FROM STG_TOOL WHERE T_L_ID = 78;
The sample date on 78th rows is T_L_ID = 1040 & Name = 'test�'
The above mentioned error re-occurs for the above query.
What does the error implies? How can this be handled/solved?
Adding details to the post:
Version: DSN11010 (version 11)
OS: z/OS
Encoding: Unicode
Toad for DB2 is being used for querying. Toad version - 5.5
For each event plan, list the plan number, count of the event plan lines, and sum of the number of resources assigned. For example, plan number “P100” has 4 lines and 7 resources assigned. You only need to consider event plans that have at least one line.
Here is my answer for this :
select DISTINCT planno, count(lineno), sum(resno)
from eventplanline, eventplan, resourcetbl
where resourcetbl.resno = eventplanline.resno
and eventplan.lineno =eventplanline.lineno;
ORA-00904 error message is a invalid identifier message.
SQL statement that included an invalid column name or referance an invalid alias get an probably ORA-00904 error. Please check EVENTPLAN table has contains LINENO column.