Issue while creating index in Oracle [closed] - oracle

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I'm trying to create an index in Oracle on table QueueData and on field XYZ which is one of the nodes of XMLTYPE column TEXT.
My query is:
CREATE INDEX IX_QUEUE_XYZ ON QUEUEDATA (extractValue(TEXT, '//XYZ')) TABLESPACE "PSAPD"
But it is giving me following error:
ORA-19025: EXTRACTVALUE returns value of only one node
I can't understand what is wrong here. Can anyone explain?

The second argument of the extractValue points to more then one node, it should return only one node, so if you have multiple tags "XYZ" it will return all of them if you use XYZ[1] only the first will be returned.
See:
http://www.w3schools.com/xpath/xpath_syntax.asp

Related

Create a column with dollar sign in Oracle SQL [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I am wondering whether I can create a column with dollar sign? The output should look like the area marked by red line. But the column can still be calculated like number.
I am not sure whether it is capable.
You can try this:
select to_char(500, '$999') from dual
Column-Name with Dollar:
CREATE TABLE t1 (ID int, "$Sal" int);
INSERT INTO t1 values(1,100);
SELECT id, "$Sal" * 10 FROM t1;

how to find a column name and value of a variable in oracle? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
I am not able to find the how to find a column name and value of a variable which is assigned in plsql procedure.
for example:
i_num_XXXX IN NUMBER;
i_str_YYYY IN VARCHAR2;
That would be
select * from user_source where lower(text) like '%i_num_xxxx%'

Oracle pl/sql check if number starts with 9 or 8 [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
i am trying to validate data inside my database that is number.
Am i able to detect the retrieved data whether it starts with 8 or 9?
For example:
8999999 is valid
9999999 is valid
7000000 is invalid
Thanks
You can try checking the first character of the field using SUBSTR():
SELECT field_value
FROM your_table
WHERE SUBSTR(TO_CHAR(field_value), 1, 1) IN ('8','9')
The following query will return all records where column data begins with an 8 or 9:
SELECT data
FROM your_table
WHERE REGEXP_LIKE (CAST(data AS varchar2(30)), '^(8|9)(*)');
I assume here that data is a numeric type, and so I cast it to varchar before using REGEXP_LIKE.

Function to convert a string to character [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
select 'open' as "documentno" from c_order
union all
select documentno as "documentno" from c_invoice
.This is not working in oracle.
i need a query that works in both oracle and postgres
You have not provided enough information to answer your question.
My guess is that you want to include columns in a union that do not have the same data type and are looking for a way to cast a number to a character value (again I'm guessing because you didn't tell us what data type documentno is).
The following works in Oracle and Postgres:
select 'open' as "documentno" from c_order
union all
select cast(documentno as varchar(20)) as "documentno" from c_invoice;
However: the first part of the union does not make sense. Why are your retrieving the same constant value for each and every row in c_order without any additional information from that table?

how to find memory utilisation of a table? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions must demonstrate a minimal understanding of the problem being solved. Tell us what you've tried to do, why it didn't work, and how it should work. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I would like to find the memory utilised by a particular table in Oracle DB. Could anyone provide me the DB query for the same?
Thanks in advance!
Following what #Alex said,
You can check the table size on disk by querying dba_segments
select segment_name , segment_type , byte/1024/1024 mb
from dba_segments
where owner = 'X'
and segment_name= 'Y';
If you want to see which or how many blocks from the table are currently stored in the cache you can query v$cache. read about it here

Resources