Archive for category ORACLE

sql find duplicate record using fields

 

SELECT COUNT(id)
FROM  Employee
GROUP BY id
HAVING ( COUNT(id )>1 )

 

using two fields

SELECT
    name, email, COUNT(*)
FROM
    users
GROUP BY
    name, email
HAVING 
    COUNT(*) > 1

Leave a comment

Oracle Network Adapter could not establish the connection

Oracle Network Adapter could not establish the connection tips

 

Question:  I am trying to install SQL Developer and when I try to open the forst screen and connect I get this network adapter error:

java.sql.SQLException: Io exception: The Network Adapter could not establish the connection.

How do I resolve this Network Adapter could not establish the connection error?

Answer:  Whenever you see a Network Adapter could not establish the connection, you have either the wrong SQL Developer URL or you have a basicSQL*Net connectivity issue!  This error is most likely caused by one of these factors:

– You are using the wrong URL

– The wrong port number or IP address (or DNS host name) was used

– The listener is not configured properly

– The listener process (service) is not running.  You can re-start it with the “lsnrctl start” command or on Windows by starting the listener service.

Leave a comment

SQL ADD,DROP COLUMN+ FK

DROP
ALTER TABLE ASSIGNMENT_DETAIL DROP COLUMN NEIGHBOURHOOD_ID;
ALTER TABLE ASSIGNMENT_DETAIL DROP COLUMN NEIGHBOURHOOD_STREET_ID;

ADD
ALTER TABLE ORGANIZATION_PERSON ADD ASSIGNMENT_ID NUMBER(38,0);
ALTER TABLE ORGANIZATION_PERSON ADD ASSIGNMENT_STATUS NUMBER(38,0);

ADD FK

ALTER TABLE ORGANIZATION_PERSON
ADD CONSTRAINT FK_Asignment_ID FOREIGN KEY (ASSIGNMENT_ID)
REFERENCES ASSIGNMENT_DETAIL(ID);

, , , ,

Leave a comment