Skip to content
Advertisement

Oracle developer. ORA-01722 Invalid Number when using UNION

I have this problem: I have two tables: Table A and Table B, with the same column called PK_COLUMN that in both tables are numeric(8, 0). I want to make this union: And I got the next error code: ORA-01722 Invalid number. The problem is that when I execute the both parts of the union separately they work perfectly! Answer

How to multiply two columns and add a new column to the database?

Which customer id bought maximum products? (hint : get sales by multiplying product_quantity and price_per_item fields) This is how the database looks like After adding the sales column I am not able to perform the sum operation and getting the following error: SELECT customerid, product_quantity * price_per_item as “sales”, SUM(sales) FROM questions GROUP BY customerid LIMIT 0, 1000 Error Code:

If a string is enclosed in quotes either ” or ‘. I have to remove those starting and ending quotes in snowflake

Check the following input/output examples: Input: “”Nag”ndra”” -> Expected output: “Nag”ndra” Input: ‘N’agendra -> Expected output ‘N’agendra I tried the below query to implement that behavior, which is able to remove the starting and ending quotes. for second example it is given as N’agendra it should be ‘N’agendra Answer If you want to keep the starting ‘ then don’t use

Select last nontrivial value from each column, by group

How might I write in SQL a query that accumulates a table of rows representing selective updates into a single “latest and greatest” row per BY group? For instance from the following table: index date ssn first last title car shoe 1 Apr 1 100-00-0001 Joseph Schmoe Analyst Honda Adidas 2 May 1 100-00-0001 Joe 3 May 16 100-00-0001 Nike

Using column from another table in trigger

I need to use a column from another table when i use trigger before insert but i get an error Unknown table in field list Here is an example code: the column from another table is “printing_time_hr” from table “slicer” Please help, what to do, how to use the column from another table Answer This works for me:

convert varchar[ ] column type to uuid[ ]

there is a column of type character varying[] , which contains data of type uuid like {0f071799-e37e-4e1c-9620-e580447416fe,913a7134-6092-45fa-ae18-163302db8112}, but there are also some old values of another type like {5edfd4edfa1bb21a142442a0}. How can the column type be converted? I used the script: alter table services alter column office_ids type uuid[] USING office_ids::uuid[]; but gives an error – invalid syntax for type uuid:

Advertisement