Posts

Showing posts with the label oracle

C# .net Core reconnect to Oracle after database enabled

C# .net Core reconnect to Oracle after database enabled I have .net Core web-api project in docker, where I connect to Oracle database. For connecting I use nugget package oracleClientCore How I connect and call stoted procedure: string cs = "Data Source = 172.10.200.100:1521/dev;PERSIST SECURITY INFO=True;USER ID=test; Password=devtest;"; using (OracleConnection connection = new OracleConnection(cs)){ connection.Open(); using (OracleCommand cmd = connection.CreateCommand()) { cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "sp_check_db"; cmd.ExecuteNonQuery(); connection.Close(); } } In stored procedure sp_check_db just make insert into table sp_check_db insert into table Sometimes the connection to database falling down and I got exception ORA-03114: not connected to ORACLE . After the database was enabled again I continue to receive same error ORA-03114: not connected to ORACLE till I rebuild and redeploy the project. ORA...

Oracle 11g SQL to split column data as mutiple column data

Oracle 11g SQL to split column data as mutiple column data I have a requirement where data is as below ID Date Comments 101 23/Jun/2018 RR: Insufficient resource 101 23/Jun/2018 Next week apply for leave 102 22/Jun/2018 NULL 103 21/Jun/2018 Go ahead I need a Oracle sql to fetch above data as ID DATE A_comments D_comments 101 23/Jun/2018 Next week apply for leave RR: Insufficient resource 102 22/Jun/2018 103 21/Jun/2018 Go ahead Whenever comment is with prefix RR: it should go to D_comments and without prefix RR it should go to A_comments for a particular ID. D_comments A_comments Help me to achieve this. What if there is more than one row with (or without) an RR prefix for the same ID? Or there is only one of each but they are on different dates? – Alex Poole Jul 2 at 8:42 ...

What is the difference between Non-Repeatable Read and Phantom Read?

Image
What is the difference between Non-Repeatable Read and Phantom Read? What is the difference between non-repeatable read and phantom read? I have read the Isolation (database systems) article from Wikipedia, but I have a few doubts. In the below example, what will happen: the non-repeatable read and phantom read ? SELECT ID, USERNAME, accountno, amount FROM USERS WHERE ID=1 1----MIKE------29019892---------5000 UPDATE USERS SET amount=amount+5000 where ID=1 AND accountno=29019892; COMMIT; SELECT ID, USERNAME, accountno, amount FROM USERS WHERE ID=1 Another doubt is, in the above example, which isolation level should be used? And why? en.wikipedia.org/wiki/Isolation_(database_systems) – Pavel Veller Jun 15 '12 at 1:59 8 Answers 8 From Wikipedia (which ...

Date format: Invalid Month

Date format: Invalid Month I have below data format 10/29/2003 10/21/2003 7:26:00 AM in a table and I want to compare dates in between '07-14-2013' and '09-15-2013'. I have written code as to_char(to_date(a.TEXT_VALUE, 'DD-MM-YYYY HH:MI:SS AM'),'dd-mm-YYYY') between '07-14-2013 00:00:00 AM' and '09-15-2013 00:00:00 AM' this is not working. Can anyone suggest what should I do to get dates between these 2 dates? How varied are the values in your text field? Do you have a mix of just dates, dates with times in 12-hour format (with AM/PM), and dates with times in 24-hour format? How sure are you that all the dates are in the same MM/DD/YYYY format? This is why dates should never be stored in varchar2 columns, but always in date columns. – Alex Poole Oct 16 '13 at 16:10 varchar2 date ...

Shell script internally call another shell script and doesnot return the ouput to main script when i use the external table

Shell script internally call another shell script and doesnot return the ouput to main script when i use the external table My main script api_call.sh internally calls config.sh and should pass the parameter value to the main script. The script works fine when I execute it in Linux. But when I queries through external table the second script does not return the output to the main script. Can anyone please tell me. Do I need to specify the location when I call the second script when I queried via external table..? And how can I return the value from the second script to the first one. Script1: apicall.sh export SourceName FileName . ./config.sh "$SourceName" "$FileName" get the application type from the config file to the main script v_application_type=$application_type Script2: config.sh while : do case $1 in xxx) application_type=application/json ...

Is the character “A” a reserved keyword in Oracle Database? [on hold]

Is the character “A” a reserved keyword in Oracle Database? [on hold] scenario: In Oracle Database, This SQL it's much slower: SELECT * FROM TBL_MAIN A, TBL_CHILD_1 B, TBL_CHILD_2 C, TBL_CHILD_3 D, TBL_CHILD_4 E WHERE A.ID_MAIN = B.ID_MAIN AND A.ID_MAIN = C.ID_MAIN AND A.ID_MAIN = D.ID_MAIN AND A.ID_MAIN = E.ID_MAIN; than that: SELECT * FROM TBL_MAIN X, TBL_CHILD_1 B, TBL_CHILD_2 C, TBL_CHILD_3 D, TBL_CHILD_4 E WHERE X.ID_MAIN = B.ID_MAIN AND X.ID_MAIN = C.ID_MAIN AND X.ID_MAIN = D.ID_MAIN AND X.ID_MAIN = E.ID_MAIN; In other words, When I have 3 or more tables joined if I use "A" as an aliasing for "TBL_MAIN" table, it results in a slower query. It becomes worst when I added more tables in an inner join with table "TBL_MAIN" AS "A". What is happening? This question appears to be off-topic. The users who voted to close gave this specific reason: I don't believe you. What does the explain plan show for these two?...

Selecting Matching values from three different table and combining them in one table in Oracle

Selecting Matching values from three different table and combining them in one table in Oracle I have Four tables as follows Review (REV_ID pk , REV_NAME) Meeting (MEETING_ID pk,MEETING_NAME,REV_ID fk to Review) Task (TASK_ID pk,TASK_NAME,REV_ID fk to Review) Answer (ANS_ID pk,ANS_NAME,REV_ID fk to Review) Now I want to select a particular Review and want to create a table with Linked meetings Linked answers Linked tasks How shall I proceed with it? I tried writing join query but I was only able to get data if Rev_ID is present in all tables? select * from (SELECT * FROM meeting WHERE EXISTS (SELECT * FROM review WHERE meeting.rev_id =review.rev_id) and meeting.rev_id=142), (SELECT * FROM answer WHERE EXISTS (SELECT * FROM review WHERE answer.rev_id =rev.rev_id) and answer.ans_rev_id=142), (SELECT * FROM task WHERE EXISTS (SELECT * FROM review WHERE task.rev_id =review.rev_id) and task.rev_id=142) r; Note : Here I tried static Rev_ID =142 to ch...