Questions tagged as 'sql'

1
answer

Character Explosion in Oracle

I have the customer base, and the customer base: COD CLIENTE 128 JOAO 129 MARIA 130 DULCE NOTA 234.123.334.128.50 235.124.338.128.49 Note that the customer code is inserted in the note number, which in this...
asked by 12.05.2017 / 16:05
2
answers

Give a select to return the unique values

I have multiple values repeated, the value can have status (different or different) or I can have two values with different / differentiated statuses, and I need to make a comparison between them (in this case I use a key). unique that are diffe...
asked by 12.05.2017 / 21:16
2
answers

Condition in procedure

Good afternoon. I have a procedure, in it I have several filters. one of these filters is @ST_TIPO -When I get by BSP Parameter I want to filter only by PT.ST_TIPO = 'BSP' -When I get by Parameter ' DIS ' I want to filte...
asked by 02.06.2017 / 23:50
1
answer

If exists update else insert in table with foreign key postgres

I need to make an insert in a table with a foreign key, so if that record does not exist in the other table I need to do an insert, can I do this using if exists? Any solution?     
asked by 08.05.2017 / 21:57
1
answer

Query where result equal to any of the values in the list

I have a table of Duplicates that has the referring month as string, (ex: 01/2012, 05/2016 and etc) I need to perform a query between a date range, if the field were DateTime I know that I would just use > = and < = but being a st...
asked by 28.04.2017 / 14:21
1
answer

Loop in pl / sql oracle

I want to know how to go through all the tuples that are stored in a table; how do I do this in PL / SQL Oracle ? Thank you in advance!     
asked by 28.04.2017 / 21:02
2
answers

Query INNER JOIN apply bind parameter

Original Query: SELECT quantity.order_id, quantity.ISBN, quantity.quantity,orders.customer_id, orders.created, orders.status FROM orders INNER JOIN quantity ON orders.order_id=quantity.order_id" Query with bind parameter: $stmt = $conn-&g...
asked by 25.05.2017 / 19:32
1
answer

Conversion to date type PostgreSQL

Hello, I'm working with a database that has the date information stored in a varchar (50) as in the following example: "2012 December 2 18:37". I need to do time-based searches. However, I'm not succeeding at converting this char to date t...
asked by 24.05.2017 / 22:00
1
answer

Declaration of 2 PK Sql

Good afternoon. I have the Icms table that has the IcmClaFiscal as the PK, I need to pass the IcmEmpresa column also as PK, but SQL returns me an alert. As I already managed to do this procedure in other cases through...
asked by 10.05.2017 / 19:07
1
answer

Return average cost between partially equal products

As I exemplify in SQL Fiddle , I need to give the tables the data to be returned as follows: / p> nome | descricao| tipo | custo| ult_lancamento | entradas | saidas ---------------------------------------------------------------...
asked by 16.05.2017 / 01:27