Skip to content

Tag: json

Implement Scan and Value functions in golang

I am trying to store some golang objects in SQL database and have implemented the scanner and value interface as follows: Is there a way that I can pass the parameter to the Value() function by pointers, as I am getting a HugeParam error that the attr passed to the Value() function is too big, when trying to …

Postgres: Searching all sub-arrays of an array

I have a Postgres table with a json column, named raw_data, that is structured like this: [{“id”:1234, “name”:”John Doe”, “purchases”:12}, {“id”:1234, “name”:”Jane Doe”, “purchases”:11}] The number of sub-arrays ca…

Extract all records from a JSON column, using JSON type

I have a couple tables (see reproducible code at the bottom): tbl1_have tbl2_have I wish to extract all json columns without providing explicit data type conversion for each columns since in my use case the names and amounts of nested attributes vary. The expected output is the same for both cases: tbl_want w…

Generate rows from JSON (SDO_GEOMETRY)

I have a multi-part SDO_GEOMETRY that I can represent as JSON (Oracle 21c): As an experiment, I want to find a way to generate rows from the JSON: Each row is a vertex of the geometry. Question: In an SQL query, is there a way to generate rows for each of the JSON vertices? I’m aware that SDO_GEOMETRY h…

Complex multi-level JSON and SQL – what am I doing wrong?

So I am able to query my JSON file fine then I wanted to add another field that is under a few levels and when I try to do this – it doesn’t work. What am I doing wrong? So the following works correctly and gives me back the first level promoter id This does not work – I get

Repeating JSON Aggregated Array with Row Limits

I have an Oracle 19 database with a JSON aggregated array which I need to cut off and repeat after a set number of rows, for example: …etc. Here’s some basic SQL to illustrate how my current dataset is put together: I need to push customer data to an API endpoint. Pushing 1 customer record at a ti…

How to generalize the JSON in stored procedure?

In my database, I have table called library which have columns like dependencies, email, alert, skipped and values are stored as I want to prepare JSON of these values which will look like as I have written have code as And my JSON doesn’t look like desired JSON I am not able to achieve correct json . C…