Posts

Showing posts with the label Oracle

ORA-01034: Oracle Not Available

It is a simple error meaning your database is down. To fix this, follow the steps given below: SQL>connect sys/password as sysdba SQL>startup SQL>exit

SP2-0110: Cannot create save file "afiedt.buf"

Image
Any query/command (single line or multiple line) we execute resides in the buffer temporarily and it is lost when we execute new query/command because new one takes that place. In case we try to edit that query/command which is in the buffer we get an error " SP2-0110: Cannot create save file "afiedt.buf" ". There are many ways to fix this, I'm going to show you three different ways. 1. Always run the SQL Command Line as administrator. Once you start this way, you will not see said error. 2. Sometimes w e get this error message because we don't have write permission on the current directory. Either start sqlplus from a different directory, or change the editfile entry in sqlplus: SQL>set editfile d:/sqledit.sql In above code, you can use any drive for this and any file name. 3. Create sqledit.sql file and save it in bin directory (sometimes this file misses cause this error) of oracle where sqlplus.exe is resides.Then run sq

Oracle Constraints

Oracle constraints are means in the process of defining some conditions about the database that must remain true while inputting/modifying/deleting data in the database. The basic structure of an Oracle constraint is defined as: The CONSTRAINT keyword is followed by a unique constraint name and then the constraint definition. The constraint name is used to manipulate the constraint once the table has been created. In Oracle, constraints can be defined at the column or table level. An example of defining constraints at table level may be: CREATE TABLE STUDENT ( STUDENT _ID NUMBER(3) CONSTRAINT S_ID CHECK (STUDENT _ID > 0), STUDENT _NAME CHAR(30) CONSTRAINT S_NAME NOT NULL, MARKS_COUNT NUMBER(6), CONSTRAINT STUDENT _PRIME PRIMARY KEY (STUDENT _ID)) Column level constraints go directly after the column definition to which they refer and the table level constraints go after the last column definition. CREATE TABLE CLASS ( ROOM NUMBER(10) CONSTRAINT ID CHECK (ID BET

Database Not Available Error in Oracle

To fix this error: (i) Click on Start > Run > Type 'cmd' and press enter (ii) Now type 'svrmgrl' and press enter (iii) Type 'connect' and press enter (iv) Type Username 'internal' and password 'oracle' and press enter (v) Type 'startup' and press enter (vi) Now it will take about 1min to process and finally click 'edit' to close cmd Now start PLSQL, you error is fixed.

Oracle Package

Basically packages is set of procedures, functions, cursors, constraints and exceptions in one unit. To execute the package we write the code as follows: EXECUTE SALARY_PACKAGE.NEW_WORKER('MICE'); In above example SALARY_PACKAGE is package name and NEW_WORKER is procedure name. Creating Package To create package user should have the CREATE PROCEDURE privilege. Two create package two techniques have to be done separetly: (i) Creating package specification A package specification includes list of functions, procedures, variables, constraints,  cursors nd exceptions and will be available for package body. CREATE OR REPLACE PACKAGE <NAME> ------- ------- Above code should be saved in saperate file with saperate name. (ii) Creating package body The name of package body should be equal to name of package specification but file name should be different than above file name.  CREATE OR REPLACE PACKAGE BODY <NAME> -------

Oracle Methods

Method is block of PL/SQL code used to encapsulate the data access method for an object, it is also specified as part of the abstract datatype specification as (CREATE OR REPLACE TYPE  MARKS_TY AS OBJECT) and their body declaration as (CREATE OR REPLACE TYPE BODY MARKS_TY AS MEMBER FUNCTION TOTMARKS()). Before to learn methods it is recommanded to get overview the abstract datatype teqniques.  Creating specification CREATE OR REPLACE TYPE MARKS_TY AS OBJECT (M1 NUMBER(3), M2 NUMBER(3), M3 NUMBER(3), MEMBER FUNCTION TOTMARKS(M1 IN NUMBER, M2 IN NUMBER, M3 IN NUMBER) RETURN NUMBER); In above example, TOTMARKS is declaration of function which will be used later in function calling to get defined.  Defining function (body declaration) CREATE OR REPLACE TYPE BODY MARKS_TY AS MEMBER FUNCTION TOTMARKS(M1 NUMBER, M2 NUMBER, M3 NUMBER) RETURN NUMBER  IS  BEGIN RETURN(M1+M2+M3); END; END; / Creating table using above abstract datatype MARKS_TY CREATE TA

Popular posts from this blog

Migrating database from ASP.NET Identity to ASP.NET Core Identity

Customize User's Profile in ASP.NET Identity System