Develop and administer Oracle databases and apps. Learn SQL and PL/SQL, indexing, performance tuning, partitions, RAC, backups, Data Guard, security, and APEX. Get deployment tips and automation scripts for stable, compliant environments.
384 posts203 contributors
I am using entity framwork and while saving record to my table I am getting below error message what would be the cause "The changes to the database were committed successfully, but an error occurred while updating the object context. The ObjectContext might be in an inconsistent state. Inner exception message: Saving or accepting changes failed because more than one entity of type 'APP_Application.Models.Employee_Log' have the same primary key value. Ensure that explicitly set primary key values are unique. Ensure that database-generated primary keys are configured correctly in the database and in the Entity Framework model. Use the Entity Designer for Database First/Model First configuration. Use the 'HasDatabaseGeneratedOption" fluent API or 'DatabaseGeneratedAttribute' for Code First configuration" I am saving data in another table not in Employee_log but there is a trigger which fire when I do insertion on other table I check the employee_log table it is having unique primary key
I have a one table in which i am storing customer and their installment amount , there are total 4 installment for each customer ,few customer missed few installment like customer ABC has installment 1 , but then he missed installment # 02 , then he get installment # 03 etc Installment # Installment Amount Customer Name 1 100 ABC 2 100 ABC 3 100 ABC 4 100 ABC 1 100 XYS 3 100 XYS 4 100 XYS 1 100 GGG As from above table you can see there are three customer , customer ABC get all installment ,customer XYS missed installment # 02 and Customer GGG get only one installment . Now I want to get the count of all customer who get 1-At least three installment 2-in this query I want to get all those customers who get three consecutive installment like 1,2,3 How to write these two queries in oracle , my table name is customer_installment
select distinct 'carTypes' as type, mi.WOMENNAME as "mother name", mi.womencnic as "mother CNIC", '' as BFORMNO, '' as child_gender, mi.PROVINCE, mi.district, mi.tehsil, mi.HUSBANDNAME, mi.PHONENO contact, mi.address, SUM(p.amount) paid_amount from MINFORMATION mi inner join PAYMENTINFORMATION p on p.BENEFICIARYID=mi.WOMENID and p.BANKSTATUS='Successfull' where mi.month IS NOT NULL and p.generationdate between '24-JUN-21' and '01-JAN-22' group by mi.WOMENNAME, mi.womencnic,mi.PROVINCE, mi.district, mi.tehsil, mi.HUSBANDNAME, mi.PHONENO , mi.address this is my query I need generationDate in select list as well which is coming from PAYMENTINFORMATION tableso after adding it in select list it ask me to add it in group by as well by doing so I am getting extra row my actual rows are 1629 but after adding generationDate in select and order by I am getting 1944 Rows how to solve it its oracle query
I have a simple asp.net web form application when i am opening the connection I am getting this error Attempt to load Oracle client libraries threw BadImageFormatException. This problem will occur when running in 64 bit mode with the 32 bit Oracle client components installed. below is my code. protected void Page_Load(object sender, EventArgs e) { string conStr = ConfigurationManager.ConnectionStrings["myconestring"].ToString(); OracleConnection con = null; OracleCommand cmd = null; OracleDataReader rd = null; string val = null; try { using (con = new OracleConnection(conStr)) { cmd = new OracleCommand(); cmd.CommandText = "select count(*) from child"; cmd.Connection = con; con.Open(); rd = cmd.ExecuteReader(); rd.Read(); val = rd.GetInt16(0).ToString(); } } catch (Exception err) { Response.Write(err.Message); } finally { con.Close(); con.Dispose(); cmd.Dispose(); } Response.Write(val); } }
In this article, you will learn about Create ,Insert, update, delete , select table , truncate table , drop table statement in Oracle Database / PL-SQL.
Hi I have a query like below and my Distribution columns in database is having number from 1-100 , as well as null some people type 90 some type 090 when performing the action it gives this below error An error was encountered performing the requested operation ORA-01722 INVALID NUMBER 01722 00000 INvalid Number Cause : The specified number was invalid Action : specify a valid number vendor code 1722 HERE IS MY QUERY SELECT NVL(SUM(NVL(mt.Distributed,0)),0) DISTRIBUTED_AMOUNT from TBL_DISTRIBUTION mq,Client information mt where mq.id=mt.id
Hi, is there is any way to know if a table is manually updated (i.e, somebody updating a table using Oracle SQL Developer tool and he has access to update that table). how can i audit log this table in Oracle and SQL Server.
I have Oracle19c is database and Oracle.DataAccess is ODP.Net with version 2.122.19.0, and application is developed in .Net framework 4.5.2, I have done POC on bulk copy records into database table where getting error as "ORA-39826 : Direct path load of view or Synonym (UserNameXXX.TableNameXX) could not be resolved. Where I have added for deleting a records from mentioned table which is working fine, exactly above the where error occured It would be great if someone help me with solution. I have follow the exact same steps mentioned in Two Ways To Insert Bulk Data Into Oracle Database Using C# (c-sharpcorner.com) in Second Option for Bulk Copy.
I have done POC on Visual Studio 2017 .Net Framework 4.5.2 with DB Oracle 19c (Version 19.3) as ODP.Net we have used dll named as Oracle.DataAccess.Client. Getting below error at C# side ORA-06502 : PL/SQL: Numeric or Value error : Character string buffer too small. Stored Procedure Create or Replace Procedure POC_Test(p_message Out Varchar2) As Begin p_Message := 'XYZ'; End POC_Test; //C# Code using System; Using Oracle.DataAcess.Client; class DataBasePOC { static void Main() { OracleConnection connection = new OracleConnection("DataSource=POC_Database;User Id=User1;Password=PQR123"); OracleCommand cmd=new OracleCommand(); connection.Open(); cmd.CommandText="POC_Test"; cmd.CommandType=CommandType.StoredProcedure; cmd.Parameters.Add("p_message", OracleDbType.Varchar2, "", ParameterDirection.Output); OracleDataAdaptor da= new OracleDataAdaptor(); da.SelectCommand=cmd; DataTable dt= new DataTable(); da.Fill(dt); connection.Close(); } }
This article explains how to set up a connection between an Oracle database and .Net Framework using C#.
Hello I am trying to build a winform app with free mysql database. I got the code from CodeProject, everything builds but the server adress doesnt appear to be right. Anyone with more experience can help please ? Please open the zip file, i was unable to past the sample code. Best regards
Hi All, i'm new to the Oracle when i'm executing the converting the xmlfile to table for that i had written the below query but when executing this getting the ORA-00904: "X"."XML_DATA": invalid identifier getting this error.
Hi All, Stored Procedure is DDL or DML Statement?
Hi Guys Please assist executing a dapper function below. I am using oracle Below query complains that its missing a FROM, but when from is added, it complains that the query is missing expression. var results = connection.Query( "select from checkpin(:Username, :Password)" , new { Username = input.Username, Password = input.Password }, commandType: CommandType.Text);
Hi All, I Need to update the columns values of Table FIRETABLE with the View FCAM_SITES_V with inner join of other tables But not able to do it, Kindly please suggest what wrong with the below query? I am getting Errro in the FROM Please provide your solutions asap. Correct the Query as well Update Query: Update FIRETABLE SET FFM.TECHNICAL_SQUARE_FEET = FSV.TECHNICAL_SQUARE_FEET, FFM.COMMON_SQUARE_FEET = FSV.COMMON_SQUARE_FEET , FFM.ROOF_REPAIRED_DATE = FSV.ROOF_REPAIRED_DATE, FFM.RAISED_FLOOR = FSV.RAISED_FLOOR, FFM.YEAR_BUILT = FSV.YEAR_BUILT, FFM.NUMBER_OF_BUILDINGS = FSV.NUMBER_OF_BUILDINGS, FFM.OCCUPIED_FLOORS = FSV.OCCUPIED_FLOORS FROM FIRETABLE FFM INNER JOIN SITES_MAPPING FSM ON FFM.FACILITY_ID =&n
Hi, it´s pósible to use only one UDATE in this instruction, nota that we use only one TABLE UPDATE COT_LINEADET SET LID_APORTE_INFORMADO = '21739', LID_DIF_APORTE = '0' WHERE PER_RUT = '26558114' AND LID_ULTFECACT between TO_DATE('31-03-2021 08:00:00', 'dd-mm-yyyy HH24:MI:SS') and TO_DATE('31-03-2021 10:00:00', 'dd-mm-yyyy HH24:MI:SS') AND LID_ULTUSUACT = 'OPS$JOLMEDO' ; UPDATE C OT_LINEADET SET LID_APORTE_INFORMADO = '10122', LID_DIF_APORTE = '0' WHERE PER_RUT = '13391016' AND LID_ULTFECACT between TO_DATE('31-03-2021 08:00:00', 'dd-mm-yyyy HH24:MI:SS') and TO_DATE('31-03-2021 10:00:00', 'dd-mm-yyyy HH24:MI:SS') AND LID_ULTUSUACT = 'OPS$JOLMEDO' ; UPDATE COT_LINEADET SET LID_APORTE_INFORMADO = '24184', LID_DIF_APORTE = '0' WHERE PER_RUT = '7921736' AND LID_ULTFECACT between TO_DATE('31-03-2021 08:00:00', 'dd-mm-yyyy HH24:MI:SS') and TO_DATE('31-03-2021 10:00:00', 'dd-mm-yyyy HH24:MI:SS') AND LID_ULTUSUACT = 'OPS$JOLMEDO' ; UPDATE COT_LINEADET SET LID_APORTE_INFORMADO = '24275', LID_DIF_APORTE = '0' WHERE PER_RUT = '7112295' AND LID_ULTFECACT between TO_DATE('31-03-2021 08:00:00', 'dd-mm-yyyy HH24:MI:SS') and TO_DATE('31-03-2021 10:00:00', 'dd-mm-yyyy HH24:MI:SS') AND LID_ULTUSUACT = 'OPS$JOLMEDO' ; UPDATE COT_LINEADET SET LID_APORTE_INFORMADO = '0', LID_DIF_APORTE = '0' WHERE PER_RUT = '9697278' AND LID_ULTFECACT between TO_DATE('31-03-2021 08:00:00', 'dd-mm-yyyy HH24:MI:SS') and TO_DATE('31-03-2021 10:00:00', 'dd-mm-yyyy HH24:MI:SS') AND LID_ULTUSUACT = 'OPS$JOLMEDO' ; UPDATE COT_LINEADET SET LID_APORTE
Hi Friends, I am sending sql db datetime field LastId paramater like this cmd = new OracleCommand("select BUSINESS_DATE, TRANS_SEQ ,sum(UNIT_PRICE) TotalPrice,,sum(VAT_AMT) TotalTax,sum(GROSS_AMT) TotalPricewithTax from LINEITM_VIEW group by TRANS_SEQ ,BUSINESS_DATE Having BUSINESS_DATE >= TO_TIMESTAMP(:LastId,'yyyyMMddHH24missffff')", con); cmd.CommandType = CommandType.Text; OracleParameter param = new OracleParameter(":LastId", OracleDbType.TimeStamp, ParameterDirection.Input); param.Value = LastID(); cmd.Parameters.Add(param); I am not getting the correct result in the front end. I am also sending oracle query like this Select \"BUSINESS_DATE\",\"TRANS_SEQ\",SUM(\"VAT_AMT\") \"TotalTax\",SUM(\"UNIT_PRICE\") \"TotalPrice\",SUM(\"GROSS_AMT\") \"TotalPricewithTax\" from \"LINEITM_VIEW\" GROUP BY \"TRANS_SEQ\",\"BUSINESS_DATE\" HAVING BUSINESS_DATE >= TO_TIMESTAMP('2018-12-31 08:52:09.270', 'yyyyMMddHH24missffff') getting errors : object cannot be cast from DBNull to other types for this error I changed query like this Select to_char(BUSINESS_DATE,'YYYY-MM-DD') BUSINESS_DATE,TRANS_SEQ,SUM(NVL(VAT_AMT, 0)) TotalTax,SUM(NVL(UNIT_PRICE, 0)) TotalPrice,SUM(NVL(GROSS_AMT, 0)) TotalPricewithTax from LINEITM_VIEW GROUP BY TRANS_SEQ,BUSINESS_DATE getting error: ORA-01810: format code appears twice missingg expression error also coming . Please tell me how to get the oacle db records by passing sql datetime parameter. &n
Hi, I need to know all some schema´s abject and after to do Grants over all those objects to a especific user. Theres is a schema and there is a User, i need to grant to a these user over these schema. Some Query? Thank u
Hi, I need to grant to some user to craete or edit a PKG, Which grant i have to use? Thanks
CREATE OR REPLACE TRIGGER audit- table -DEPT AFTER INSERT OR UPDATE OR DELETE ON DEPT FOR EACH ROW declare audit_data DEPT$audit%ROWTYPE; begin if inserting then audit_data.change_type := 'I' ; elsif updating then audit_data.change_type := 'U' ; else audit_data.change_type := 'D' ; end if; audit_data.changed_by := user ; audit_data.changed_time&nb
Hi, some risk or fatal event after excecute a commit after a truncate table? truncate table schema.table; commit; if it so, how to fixed it on Oracle 12c Thanks a lot out there
I am using Oracle 11g. I want to encrypt the full database.
Hi, I have a error : ORA-01002: fetch out of sequence in this PRC: PROCEDURE PRC_AAA (P_FECHAINI IN BBB_RENDICION.TPPC_FCH_AP%TYPE ,P_FECHAFIN IN BBB_RENDICION.TPPC_FCH_AP%TYPE ,P_LISTA_RESP OUT sqlcur ,P_ERRORCOD OUT NUMBER ,P_ERRORMSG OUT VARCHAR2) IS V_FECHAINI vfecha; V_FECHAFIN vfecha; BEGIN V_FECHAINI := TO_CHAR(P_FECHAINI,'DD-MM-YYYY'); V_FECHAFIN := TO_CHAR(P_FECHAFIN,'DD-MM-YYYY'); OPEN P_CURSOR_1 FOR SELECT T1.COD_RESP_AP AS COD_RESP_AP ,T1.ESTADO AS GLOSA_AP ,T1.CANAL AS CANAL ,DECODE(T1.CANAL, 10, 'Menú', 'Financiero') AS DESC_CANAL ,COUNT(T1.PROCESADOS) AS PROCESADOS ,SUM(T1.MONTO_TOTAL) AS MONTO_TOTAL ,T1.COD_SISTEMA AS COD_SISTEMA FROM ( SELECT REND.TPPC_COD_AP AS COD_RESP_AP</di
I am using SharePoint 2016. I have this requirement, read SharePoint list data into write oracle table. SQL Server or remote/connected Oracle database to get SharePoint data into Oracle ? Are there possible solutions?
I am inserting hindi text in oracle db but not insert in hindi column value is ????????????????????? ????? ???? ????????? ?? ???? ??????? ?? ??? ?????????? ??? ????????? ????? insert into QUES_MASTER(QUES_CODE,QUES_DESC_ENG,QUES_DESC_HINDI,QUES_SNO,STATUS,OPTION_ID,SURVEY_ID) values('38','Please refer to guidance note document for more information on focus areas.','????? ???? ????????? ?? ???? ??????? ?? ??? ?????????? ??? ????????? ?????','1','A','7','7')