Skip to content
Advertisement

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 convert the

Performing division with PostgreSQL / json

I have written a simple query against a table in a Postgres database that contains a column “manifest” of type json. Each cell contains a very long value and I am extracting the numerical value for “size”. I need to create a new column (perhaps call it “size in MB”), and perform division against size. Specifically, I need to take

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 can differ. It may be 1 or 20 or any number. I want to perform a query where I can return the entire table row if, say, ‘John Doe’ occurs in the

Can anyone help me on how to fetch MySQL table/s data in JSON format by querying itself which is similar to MS SQL Server

Below is the existing T-SQL code which generates table data in JSON format just by using the keyword FOR JSON PATH, include_null_value. How to implement the same in MySQL query itself??? Need possible solutions. /** Sample Table data in MS SQL server ***/ /** Fetching table data in JSON format ***/ key value , {“id”:4,”name”:”Rajini”,”state”:null} , {“id”:1,”name”:”Swapna”,”state”:”Bangalore”} , {“id”:2,”name”:”Divya”,”state”:”Hyderabad”} ,

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 with a_i and a_j correctly stored as a

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 has a

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 time is not

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 . Can someboby please

Advertisement