Questions tagged as 'oracle'

2
answers

With limiting the result of Select in Oracle

I'm doing a select from the bank and it's returning me 15 lines. I used ROWNUM to get the first 8 lines, but I want to make another select and pick up from line 9 to 15. SELECT * FROM (SELECT DISTINCT o.STORAGE_TYPE, COUNT(o.QUANTIDADE) as qt...
asked by 01.10.2018 / 16:35
1
answer

Get constraint name and drop then

I have a constraint UNIQUE in the PERSON table and is in the CPF field. To get the name of this contraint I use the query: SELECT UC.CONSTRAINT_NAME FROM USER_CONSTRAINTS UC INNER JOIN USER_TAB_COLUMNS UT ON UT.TABLE_NAME...
asked by 13.06.2018 / 17:04
1
answer

ORA-00907: right parenthesis not found - Help

I'm trying to create the following table in SQL create table Compra ( CodCompra number(3) primary key, DataCompra date, DataEntrega date, Fornecedor foreign key Fornecedor REFERENCES (codfornecedor)Fornecedor )    ORA-009...
asked by 08.09.2018 / 00:29
2
answers

Date in SQL ORACLE

How do I apply a function in SQL ORACLE that just brings me records from the current month? Note: I have a date column in date format (eg 13/13/18). In the sql server I applied the function below and worked perfectly: DAT_REFERENCIA>= DA...
asked by 13.09.2018 / 19:32
1
answer

how to add values from different records?

I'm trying to add the value of id 1 and the value2 of id 2 which in this case would equal 220, how do I do this query ? ID VALOR VALOR2 ---------- ---------- ---------- 1 110 100 2 1...
asked by 08.04.2018 / 17:57
1
answer

How to do sub-query correctly in Oracle?

I need to do a sub-query from a table to find all the employees working in the same department that is part of São Paulo, but I'm not getting it. That is, I need to select from the three tables, departments , employees and locati...
asked by 30.10.2017 / 02:21
1
answer

Create a filter of 90 days before a period

I need you to bring results that have completed 90 days within an informed period. For example, I have the possibility to do: DT_INICIO_REAL <= (sysdate-90) , will result in 90 days from the current date or DT_INICIO_REAL BE...
asked by 30.10.2017 / 16:34
1
answer

How to create a Foreign key and unique attribute at the same time?

I wonder if there is any way, or how best, to restrict a relationship between two entities, one of which can not be repeated in this relationship. I have the 'Customers' and 'Telephone' tables. But 1 customer can have several phones, so I made a...
asked by 30.10.2017 / 02:52
1
answer

Error executing function in PL / SQL

Code CREATE OR REPLACE FUNCTION BuscaNome RETURN t_name IS t_name VARCHAR(20); BEGIN SELECT T.DS_TURMA INTO t_name FROM TURMA T WHERE T.CD_TURMA = 13; RETURN t_name; END; Error:    Error: PL / SQL: Compilation unit an...
asked by 22.01.2018 / 19:18
1
answer

Return Oracle Timestamp

I want to convert a date to a number, a timestamp. Within a select I need to return the timestamp beyond it. Query example: Select sysdate, TIMESTAMP_DE_SYSDATE from dual Timestamp is a time stamp (or time stamp) that is a st...
asked by 03.10.2017 / 14:47