in Education by
I have the following stored in an Oracle database as JSON: { value: [1,2,3] } The value can be of any type (strings, integers or arrays). How would I query if the type is array and if it contains a certain value? In pseudocode: SELECT * FROM TABLE WHERE COLUMN_NAME.value CONTAINS 2 I can see how to query strings using Oracle functions such as json_query but cannot see how to run this specific type of query without selecting all data and searching on the client. JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
You may use JSON_TABLE in the FROM, defining the columns and then use it in where clause to filter rows. --Test data with t (id,j) as ( select 1, TO_CLOB( '{ value : [1,2,3] }') FROM DUAL ) --Test data ends-- select t.id,tbl.val FROM t cross join json_table(j,'$.value[*]' columns (val varchar2(100) path '$') ) as tbl where tbl.val = 2 ID VAL ------ ------- 1 2

Related questions

0 votes
    Table: UserId, Value, Date. I want to get the UserId, Value for the max(Date) for each UserId. ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 19, 2022 in Education by JackTerrance
0 votes
    We are testing out Oracle at my work and im in charge of building all of the database objects ( ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    write a program to print fibonacci series . write a program to search an element within the array using binary search Select the correct answer from above options...
asked Dec 29, 2021 in Education by JackTerrance
0 votes
    I have a CLOB column with the following data (simplified for the purposes of this question) { "notUsed" ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 20, 2022 in Education by JackTerrance
0 votes
    I was unable to find a solution that is identical with the issue I am trying to solve. If is a ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 24, 2022 in Education by JackTerrance
0 votes
    I was unable to find a solution that is identical with the issue I am trying to solve. If is a ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 23, 2022 in Education by JackTerrance
0 votes
    I'm stuck at the point of parsing a JSON array of dicts (http://www.cjs-design.nl/json.php) ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 4, 2022 in Education by JackTerrance
0 votes
    Considering the following sorted array and the search key as 89, what will be the sequence of keys in the array ... searching for 89? Select the correct answer from above options...
asked Dec 19, 2021 in Education by JackTerrance
0 votes
    search element 20 30 40 60 70 80 90 100 element in an array find the element 20 Select the correct answer from above options...
asked Nov 29, 2021 in Education by JackTerrance
0 votes
    Which is a wrapped Java array, accessed from within JavaScript code? (a) JavaArray (b) JavaClass (c) ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 21, 2021 in Education by JackTerrance
0 votes
    What I'm trying to do here is iterate inside a Json Object obtained from an API Call in order to ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 13, 2022 in Education by JackTerrance
0 votes
    newbie question: how do i make my JSON output ignore null values? I don't want to necessarily set ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 7, 2022 in Education by JackTerrance
0 votes
    newbie question: how do i make my JSON output ignore null values? I don't want to necessarily set ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 7, 2022 in Education by JackTerrance
0 votes
    I have to insert data in a table. It has a colum whose values should negative numbers like -1,-2 ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 4, 2022 in Education by JackTerrance
...