Friday 24 July 2015

[Solved] ORA-20003: ORU-10036: object is invalid and cannot be described ORA-06512: at "SYS.DBMS_DESCRIBE",







Hi, I got this error because of my previous post...  ;)

ORA-20003: ORU-10036: object is invalid and cannot be described ORA-06512: at "SYS.DBMS_DESCRIBE",

But finally I got a solution, .. that here I post..


This will happens when we made operations such as upgrades, patches and DDL changes are  invalidate schema objects, so we need to recompile these invalidate object for further processing.

We can solve it manually like this,


ALTER PACKAGE my_package COMPILE;

ALTER PACKAGE my_package COMPILE BODY;

ALTER PROCEDURE my_procedure COMPILE;

ALTER FUNCTION my_function COMPILE;

ALTER TRIGGER my_trigger COMPILE;

ALTER VIEW my_view COMPILE; 


Also there is a another method, I used it because ....... ;)

 Login in SQL plus as SYSDBA and execute utlrp.sql file.








Don't worry copy this ....      @?\rdbms\admin\utlrp.sql       :D

How to change not null column to null ?












 Here is the code ...
.


  ALTER TABLE DRIVER_MASTER
  MODIFY (DRIVER_LICENCE_No NULL); 


Here I change my DRIVER_LICENCE_No  field to  nullable.

Tuesday 21 July 2015

Get serial number with select query





Yes,  We can select serial number / record number with our selected result from sql server , Its very easy , here is the code

SELECT ROW_NUMBER() OVER (ORDER BY EmployeeName) AS   SlNo, 
              Department ,
              EmployeeCode,
              EmployeeName           
FROM    EmployeeMaster
WHERE  Active = 1
 

Here I used  ROW_NUMBER() function to get  serial number with the ascending order of employee name.  There is an option to get result order against multiple fields like this

ROW_NUMBER() OVER (ORDER BY Department ,EmployeeName)  AS  SlNo 


Sunday 19 July 2015

How to know sql server version and edition?


         







 We can easily identify the server version and edition by execute an SQL query in SQL server. Here is the code ...




SELECT Serverproperty('Edition')        AS Edition,
       Serverproperty('ProductVersion') AS ProductVersion