30 Apr 2013

C++ PDF Books For Study at Home...

Top C++ Books that makes C++ Learning Easy......

(1)The_C++_Programming_Language

by_Bjarne Stroustrup 
                                                This book introduces standard C++† and the key programming and design techniques supported by C++. Standard C++ is a far more powerful and polished language than the version of C++ introduced by the first edition of this book. New language features such as namespaces, exceptions, templates, and runtime type identification allow many techniques to be applied more directly than was possible before, and the standard library allows the programmer to start from a much higher level than the bare language. About a third of the information in the second edition of this book came from the first. This third edition is the result of a rewrite of even larger magnitude. It offers something to even the most experienced C++ programmer; at the same time, this book is easier for the novice to approach than its predecessors were. The explosion of C++ use and the massive amount of experience accumulated as a result makes this possible.

Click Here to Download The PDF Book... 

(2) The C++ Weekend Crash Course 
by_Stephen R. Davis
                                                     C++ Weekend Crash Course teaches the reader C++ in one admittedly busy weekend: 30 sessions of a half-hour each, for 15 hours stretching from Friday evening to Sunday afternoon. At the end of each part of the book, you’ll get a chance to pause, reflect, and review what you’ve just learned before pushing on through the rest. C++ Weekend Crash Course is intended for the beginner through the intermediate reader. This book serves the beginner by not assuming any knowledge of programming or programming concepts. The first few lessons go over real-world, non-techie explanations of what programming is. This book is also great for the home programmer. The multiple examples demonstrate programming techniques used in modern, high speed programs.

Click Here To Download PDF Book... 


(3) The C++ Essantials
by_Sharam Hekmat
                                                                           The book is divided into 12 chapters. Each chapter has a flat structure, consisting of an unnumbered sequence of sections, most of which are limited to one or two pages. The aim is to present each new topic in a confined space so that it can be quickly grasped. Each chapter ends with a list of exercises. Answers to all of the exercises are provided in an appendix. Readers are encouraged to attempt as many of the exercises as feasible and to compare their solutions against the ones provided. For the convenience of readers, the sample programs presented in this book (including the solutions to the exercises) and provided in electronic form.
Click Here To Download PDF Book...

(4) The C++ Tutorials
by_Juan Soulié
                                                                    The tutorial is divided in 6 parts and each part is divided on its turn into different sections covering a topic each one. You can access any section directly from the section index available on the left side bar, or begin the tutorial from any point and follow the links at the bottom of each section.Many sections include examples that describe the use of the newly acquired knowledge in the chapter. It is recommended to read these examples and to be able to understand each of the code lines that constitute it before passing to the next chapter. A good way to gain experience with a programming language is by modifying and adding new functionalities on your own to the example programs that you fully understand. Don't be scared to modify the examples provided with this tutorial, that's the way to learn!

29 Apr 2013

Five PDF Books For C Programming That You Might Don't Know About.......

C Programming
The C Programming Language
by Brian W. Kernighan & Dennis M. Ritchie
                This book is meant to help the reader learn how to program in C. It contains a tutorial introduction to get new users started as soon as possible, separate chapters on each major feature, and a reference manual. Most of the treatment is based on reading,writing and revising examples, rather than on mere statements of rules. For the most part, the examples are complete, real programs rather than isolated fragments. All examples have been tested directly from the text, which is in machine-readable form. Besides showing how to make effective use of the language, we have also tried where possible to illustrate useful algorithms and principles of good style and sound design.


Fundamentals of C Programming
by Dilum Bandara
                This book is written by Dilum Bandara. This book is affiliated to the Faculty of Computer science and engineering in the university of Moratuwa, Sri Lanka. As Per my reading this book is suitable for all trainees who are learning A B C of language C.



C Language Tutorial
by Gordon Dodrill, Coronado Enterprise.
                This version of the tutorial is customised to suit HiTech C. The original MS-DOS version by Gordon Dodrill was ported to the Applix 1616 (with great effort) by Tim Ward, and typed up by Karen Ward. The programs have been converted to HiTech C by Tim Ward and Mark Harvey, while Kathy Morton assisted greatly in getting Visual Calculator working. All have been tested on the Applix 1616/OS multitasking operating system. The Applix distribution disks contain the complete original text of this tutorial, plus all the converted C source code. The second disk contains executable, relocatable versions of all the programs, ready to run on an Applix 1616. There is also a directory of the original IBM source code, for those using IBM computers, who may wish to try them with a different compiler.
                    This printed version has been edited, indexed and pretty printed by Eric Lindsay, who added the Applix specific material. This printed version of the tutorial includes copies of all the code, for easier reference. It also includes a comprehensive table of contents, and index.



Essential C
by Nick Parlante
                                 This Stanford CS Education document tries to summarize all the basic features of the C language. The coverage is pretty quick, so it is most appropriate as review or for someone with some programming background in another language. Topics include variables, int types, floating point types, promotion, truncation, operators, control structures (if, while, for), functions, value parameters, reference parameters, structs, pointers, arrays, the preprocessor, and the standard C library functions.

 
OUCS  Programming in C

by Original Author: Stephen Gough
Revised by: Brevan Miles


                                          This userguide was written to complement the Oxford University Computing Service course Programming in C, but also to serve as a reference to the essential aspects of C. It aims to introduce the C language to those already familiar with programming in another language (as covered on Introduction to programming in Pascal or Introduction to programming in Visual Basic courses). It will show how fundamental programming structures are implemented using the syntax of C. This guide and the OUCS course will teach ANSI C (see [5]), but where it differs significantly from Kernighan and Ritchie (K&R) C, the K&R method may have been included. It is useful to see the K&R variants, as it is possible that you will encounter K&R code.



27 Apr 2013

Five New Windows 7 Softwares That You Must Have

Five New Windows 7 Softwares That You Must Have

CCleaner:-

                         CCleaner supports the cleaning of temporary or potentially unwanted files left by certain programs, including Internet Explorer, Firefox, Google Chrome, Opera, Safari, Windows Media Player, eMule, Google Toolbar, Netscape, Microsoft Office, Nero, Adobe Acrobat, McAfee, Adobe Flash Player, Sun Java, WinRAR, WinAce, WinZip, GIMP and other applications along with browsing history, cookies, recycle bin, memory dumps, file fragments, log files, system caches, application data, autocomplete form history, and various other data. The program also includes a registry cleaner to locate and correct problems in the Windows registry, such as missing references to shared DLLs, unused registration entries for file extensions, and missing references to application paths. As of v2.27, CCleaner can wipe the MFT free space of a drive, or the entire drive itself.
                          CCleaner can be employed to uninstall programs. In addition, CCleaner allows the alteration of start-up programs, similar to the Microsoft Windows MSConfig utility. Users can disable start-up programs.As of version 2.19.901, CCleaner also allows users to delete system restore points.

To Download CCleaner Please Click Here....

 TuneUp Utilities:-

            TuneUp Utilities is a utility software suite for Microsoft Windows designed to help manage, maintain, optimize, configure and troubleshoot a computer system. It is produced and developed by TuneUp Software GmbH, headquartered in Darmstadt, Germany and co-founded by Tibor Schiemann and Christoph Laumann in 1997. The American version of the software is distributed by TuneUp Corporation, a wholly owned subsidiary of TuneUp Software  located in Miami, Florida.
        As of 2011, nine versions of TuneUp Utilities have been released and the number of included components have been increased from sixteen to thirty-two. TuneUp Utilities have attained generally positive reviews, although multiple reviewers did not approve of its price for value.

To Download TuneUp Utilities Please Click Here....

PC Tools Performance Toolkit:-

                              PC Tools Performance Toolkit offers easy-to-use tools for speeding up your PC, optimizing performance, and protecting your privacy. It improves your Windows® experience regardless of your level of expertise by using advanced technology to boost speed, improve stability, monitor your system, and tune up services. Additionally, it accelerates start times, recovers lost data, and repairs hard drives to keep your computer running like new.

To Download PC Tools Performance Toolkit Please Click Here....

Driver Genius Professional:-

                        Driver Genius Professional is a professional driver management tool features both driver management and hardware diagnostics. Driver Genius provides such practical functions as driver backup, restoration, update and removal for computer users. If you often reinstall your operating system, you may not forget such painful experiences of searching all around for all kinds of drivers. If unfortunately you have lost your driver CD, the search will be more troublesome and time-consuming.

       To Download Driver Genius Professional Please Click Here....

Advanced Systemcare Pro:-

        Advanced SystemCare PRO Edition The World’s Top System Utility for Superior PC Health. Advanced SystemCare PRO (formerly Advanced WinodwsCare Professional) provides an always-on, automated, all-in-one PC Healthcare Service with anti-spyware, privacy protection, performance tune-ups, and system cleaning capabilities. This powerful and award-winning precision tool fixes stubborn errors, cleans out clutter, optimizes internet and download speeds, ensures personal security and maintains maximum computer performance automatically.

To Download Advanced Systemcare Pro Please Click Here.... 


Top Most Antivirus to have in any PC Suggested By Me.

Top Most Antivirus to have in any PC Suggested By Me.

Most Successful Antiviruses

  1. BitDefender:-

         Bitdefender is an antivirus software suite developed by Romania-based software company Softwin. It was launched in November 2001, and is in its 16th build version. The 2013 version was launched in June 2012, and it includes several protection and performance enhancements such as Search Advisor and Performance Optimizer. The 2013 version was launched in 25 June 2012.

        The Bitdefender products feature antivirus and antispyware, personal firewall, privacy control, user control and backup for corporate and home users. PC Tuneup and Performance Optimizer are available in the Total Security Suite.

  2. ESET:-

         ESET is an IT security company headquartered in Bratislava, Slovakia that was founded in 1992 by the merger of two private companies.        
        In May 2011, ESET began publicly beta testing ESET NOD32 Antivirus and ESET Smart Security version 5 which has now been released as a free upgrade to all current ESET NOD32 & Smart Business 4.x license holders as well a free trial for first time clients. Improvements in ESET NOD32 and Smart Security 5 includes an Enhanced Media Control that automatically scans all USB, external and CD/DVD drives for any threats and blocks removable media based on type and manufacturer of the media. 
            Users can customize the behavior of the software by specifying rules for current running processes, programs, registry and tweak the security posture of the software. Gamer Mode being introduced into the software conserves system resources and activities for gaming and other full screen programs by halting all pop-up windows that require user intervention. The new ESET Live Grid is a new cloud powered real-time protection scanner that protects against online based internet threats and online social-media exploits. Parents now have control over the computer with ESET Parental Control feature that blocks potentially offensive and dangerous web content by specifying rules and selecting various pre-defined categories.

  3. Quick Heal:-

         In 1993, Quick Heal Technologies Pvt. Ltd. was initially started as CAT Computer Services (P) Ltd., a computer service center bootstrapped by Mr. Kailash Katkar from a one-room space. He had a lot of pride in his craftsmanship, keen business acumen and wanted to use it for the sole purpose of catering to customers. His younger brother Sanjay Katkar was just out of engineering school with a project on anti-viruses that had piqued the interest of all computer enthusiasts. He started designing products based on reverse engineering to resolve computer virus issues.
        In 1994 the first Quick Heal anti-virus for DOS was released followed by Win 3.1 in 1995 and Windows 95 in 1996.Quick Heal has a global footprint with offices across the world. The company has continued to grow its international presence with new offices in US, Japan and Kenya set up in 2012. This is in addition to a thick and well-connected network of dealers and channel partners in more than 60 countries globally.It features Core Protection, Web Security, Browser Sandbox, Data Theft Protection, Parental Control, Email Security, Privacy Protection, PC2Mobile scan, PCTuner, USB Drive Protection, Silent Mode.
  4. Avast!

        Avast! (styled avast!) is - both freeware and payable - an antivirus computer program with user interface that includes 41 languages, available to Microsoft Windows, Mac OS X and Linux users. The name Avast is an acronym of "Anti-Virus – Advanced Set". The official, and current logo of Avast! is a white orb with the letter 'a' on it and an orange circle around it, sticking out to four directions.

        Its developer, AVAST Software a.s. (formerly known as ALWIL Software a.s.), has headquartered in Prague, Czech Republic, with offices in Linz, Austria; Friedrichshafen, Germany; and San Mateo, California.
         Antivirus kernel based on certified antivirus engine.Resident protection comprising individual modules or "shields", each of which can be individually configured or disabled:File System Shield, Mail Shield, Web Shield, P2P Shield, IM Shield, Script Shield, Network Shield, Behavior Shield, Anti-spyware, Anti-rootkit capabilities, Self-Protection.
  5. AVG:-


          AVG was founded in 1991 with the express purpose of protecting people around the world using the latest in cutting edge security technologies. AVG gained success quickly and is now recognized as one of the biggest players in the security software market. AVG currently holds corporate offices in Europe such as in The Netherlands, Czech Republic, Cyprus, UK, Germany, France; in the US such as in the Pensacola area in Florida, San Francisco Bay Area in California, Atlanta area in Georgia, Boston area in Massachusetts, Charlotte area in North Carolina; in the Middle East, in Israel; in Asia such as Beijing and Hong Kong in China.
            Detects and stops viruses, threats and malware, Download and share files safely, Stops instant messaging viruses, Keeps your email protected, Protected when shopping and banking,Protects personal data from hackers, Faster scan and video streaming, Keeps your PC running more smoothly,free phone support.

25 Apr 2013

Database Concepts

Database:- 

                      A database is an organized collection of data. The data is typically organized to model relevant aspects of reality (for example, the availability of rooms in hotels), in a way that supports processes requiring this information (for example, finding a hotel with vacancies).
                     Database management systems (DBMSs) are specially designed applications that interact with the user, other applications, and the database itself to capture and analyze data. A general-purpose database management system (DBMS) is a software system designed to allow the definition, creation, querying, update, and administration of databases. Well-known DBMSs include MySQL, PostgreSQL, SQLite, Microsoft SQL Server, Microsoft Access, Oracle, Sybase, dBASE, FoxPro, and IBM DB2. A database is not generally portable across different DBMS, but different DBMSs can inter-operate by using standards such as SQL and ODBC or JDBC to allow a single application to work with more than one database.
                      Formally, the term "database" refers to the data itself and supporting data structures.. A "database management system" (DBMS) is a suite of computer software providing the interface between users and a database or databases. Because they are so closely related, the term "database" when used casually often refers to both a DBMS and the data it manipulates.
                    Outside the world of professional information technology, the term database is sometimes used casually to refer to any collection of data (perhaps a spreadsheet, maybe even a card index). This article is concerned only with databases where the size and usage requirements necessitate use of a database management system.
 

The interactions catered for by most existing DBMS fall into four main groups:
•    Data Definition. Defining new data structures for a database, removing data structures from  the database, modifying the structure of existing data.
•    Update. Inserting, modifying, and deleting data.
•    Retrieval. Obtaining information either for end-user queries and reports or for processing by applications.
•    Administration. Registering and monitoring users, enforcing data security, monitoring performance, maintaining data integrity, dealing with concurrency control, and recovering information if the system fails.          A DBMS is responsible for maintaining the integrity and security of stored data, and for recovering information if the system fails. Both a database and its DBMS conform to the principles of a particular database model."Database system" refers collectively to the database model, database management system, and database.
          Physically, database servers are dedicated computers that hold the actual databases and run only the DBMS and related software. Database servers are usually multiprocessor computers, with generous memory and RAID disk arrays used for stable storage. Hardware database accelerators, connected to one or more servers via a high-speed channel, are also used in large volume transaction processing environments. 

                 DBMSs are found at the heart of most database applications. DBMSs may be built around a custom multitasking kernel with built-in networking support, but modern DBMSs typically rely on a standard operating system to provide these functions. Since DBMSs comprise a significant economical market, computer and storage vendors often take into account DBMS requirements in their own development plans.


24 Apr 2013

Diffference between SQL and SQL*Plus

Diffrence between SQL and SQL*Plus

SQL : 

  •  SQL is Language.  
  •  It is Based on ANSI Standard SQL.
  •  It is entered into the SQL buffer on one or more lines. 
  •  SQL can not be abbreviated. 
  •  It uses a termination character to execute command immediately.
  •  SQL statements manipulate data and table definition in the database.
SQL*Plus :
  • SQL*Plus is an environment.
  • It is oracle proprietary interface for executing SQL statements.
  • It is entered one line at a time,not stored in the SQL buffer.
  • SQL*Plus can be abbreviated.
  • It does not require termination character.Commands are executed immediately.
  • It does not allow manipulation of values in the database.

Smart Internet Searching.

Smart Internet Searching!


Hey!!!  Are  You not getting what You want on websites and Search engine???? Try this Link and get the Latest website's URL for getting your stuff on the internet !!!

22 Apr 2013

Corporate/technical timeline of Oracle.

Corporate/technical timeline of:-

•    1977: Larry Ellison and friends founded Software Development Laboratories (SDL).
•    1978: Larry Ellison writes the first multi-platform rootkit with integrated storage data language (SDL). Oracle Version 1, written in assembly language, runs on PDP-11 under RSX, in 128K of memory. Implementation separates Oracle code and user code. Oracle V1 is never officially released.
•    1979: SDL changed its company-name to "Relational Software, Inc." (RSI) and introduced its product Oracle V2 as an early relational database system - often cited as the first to be commercially sold. The version did not support transactions, but implemented the basic SQL functionality of queries and joins. (RSI never released a version 1 - instead calling the first version version 2 as a marketing gimmick.)
•    1982: RSI in its turn changed its name, becoming known as "Oracle Corporation", to align itself more closely with its flagship product.
•    1983: The company released Oracle version 3, which it had re-written using the C programming language and which supported COMMIT and ROLLBACK functionality for transactions. Version 3 extended platform support from the existing Digital VAX/VMS systems to include Unix environments.
•    1984: Oracle Corporation released Oracle version 4, which supported read-consistency.
•    1985: Oracle Corporation released Oracle version 5, which supported the client–server model—a sign of networks becoming more widely available in the mid-1980s.
•    1986: Oracle version 5.1 started supporting distributed queries.
•    1988: Oracle RDBMS version 6 came out with support for PL/SQL embedded within Oracle Forms v3 (version 6 could not store PL/SQL in the database proper), row-level locking and hot backups.
•    1989: Oracle Corporation entered the application products market and developed its ERP product, (later to become part of the Oracle E-Business Suite), based on the Oracle relational database.
•    1990: the release of Oracle Applications release 8
•    1992: Oracle version 7 appeared with support for referential integrity, stored procedures and triggers.
•    1997: Oracle Corporation released version 8, which supported object-oriented development and multimedia applications.
•    1999: The release of Oracle8i aimed to provide a database inter-operating better with the Internet (the i in the name stands for "Internet"). The Oracle8i database incorporated a native Java virtual machine (Oracle JVM, also known as "Aurora").
•    2000: Oracle E-Business Suite 11i pioneers integrated enterprise application software
•    2001: Oracle9i went into release with 400 new features, including the ability to read and write XML documents. 9i also provided an option for Oracle RAC, or "Real Application Clusters", a computer-cluster database, as a replacement for the Oracle Parallel Server (OPS) option.
•    2002: the release of Oracle 9i Database Release 2 (9.2.0)
•    2003: Oracle Corporation released Oracle Database 10g, which supported regular expressions. (The g stands for "grid"; emphasizing a marketing thrust of presenting 10g as "grid computing ready".)
•    2005: Oracle Database 10.2.0.1—also known as Oracle Database 10g Release 2 (10gR2)—appeared.
•    2006: Oracle Corporation announces Unbreakable Linux and acquires i-flex
•    2007: Oracle Database 10g release 2 sets a new world record TPC-H 3000 GB benchmark result
•    2007: Oracle Corporation released Oracle Database 11g for Linux and for Microsoft Windows.
•    2008: Oracle Corporation acquires BEA Systems.
•    2010: Oracle Corporation acquires Sun Microsystems.
•    2011: Oracle Corporation acquires web content management system FatWire Software.
•    2013: Oracle has released a large package of security updates for Java which addresses 50 vulnerabilities in Java both in the browser and in the serve.
With the Thanks for the help of 



21 Apr 2013

Important C++ Exam and Interview Questions.

Important C++ Exam and Interview Questions.

  1. Why main function is special in C++ ?

  2. What is run-time error, logical error and syntax error?

  3. What is the role of #include directive in C++?

  4. What is compiler and linker?

  5. Why is char often treated as integer data type in C++ ?

  6. What is type conversion in C++ ?

  7. What is type castin>g in C++ ?

  8. What is the effect of absence of break in switch case in C++ ?

  9. In control structure switch-case what is the purpose of default in C++ ?

  10. What is the difference between while and do-while loop?

  11. What is the difference between call by value and call by reference in a user defined function in C++?

  12. What is preprocessor directive?

  13. What is the difference between local variable and global variable?

  14. What is the role of #define in C++?

  15. What are the major differences between Object Oriented Programming        and Procedural Programming?

  16. What are the basic concepts of OOP?

  17. How is OOP implement in C++?

  18. What is abstract class?

  19. What is concrete class?

  20. What is a constructor? What are its features?

  21. What does a destructor do?

  22. Define inheritance.

  23. Define Base class and derived class.

  24. What are the different forms of inheritance in C++ ?

  25. What is virtual base class in C++ ? What is its significance?

  26. How are binary files different from text files in C++?

  27. What is a stream? Name the streams generally used for file I/O.

  28. Difference between get() and getline().

  29. Difference between ios::app and ios::out.

  30. What is pointer?

  31. What is pointer arithmetic ? How is it performed?

  32. Differentiate between static and dynamic allocation of memory.

  33. What do you understand by memory leaks? How can memory leaks be avoided?

  34. What is this pointer? What is its Significance?

  35. What is the full form of LIFO? Give an example of LIFO list?

  36. What is the full form of FIFO? What is FIFO list technically called?

  37. What are the preconditions for Binary search to be performed on a single dimensional array?

Important Oracle Queries that you might Face in an Interview......

Important Oracle Queries that you might Face in an Interview......

Q.What is the purpose of database links in Oracle?

Database links are created to establish communication between different databases or different environments such as development, test and production of the same database. The database links are usually designed to be read-only to access other database information . They are also useful when you want to copy production data into test environment for testing.

Q. What is Oracle's data dictionary used for?

Data dictionary in Oracle contains information about all database objects such as tables, triggers, stored procedures, functions, indexes, constraints, views, users, roles, monitoring information, etc.

Q. Which data dictionary objects are used to retrieve the information about the following objects from a given schema?
1) tables
2) views
3) triggers
4) procedures
5) constraints
6) all of the above mentioned objects

The objects used are:
a> user_tables or tabs
b> user_views
c> user_triggers
d> user_procedures
e> user_constraints
f> user_objects


fferent SQL queries in the same PL/SQL program vs. design time declared explicit cursors with an association to only one query.


Q. You want to view top 50 rows from Oracle table. How do I this?

Use ROWNUM, the pseudo column in where clause as follows:
Where rownum < 51

After complete execution of query and before displaying output of SQL query to the user oracle internally assigns sequential numbers to each row in the output. These numbers are held in the hidden column or pseudo column that is a ROWNUM column. Now it is so simple to apply the above logical condition, as you would have done to any other column of the table.

Q. How do you reference column values in BEFORE and AFTER insert and delete triggers?

The BEFORE and AFTER insert triggers can reference column values by new collection using keyword “:new.column name”. The before and after delete triggers can reference column values by old collection using keyword “:old. column name”.

Q. Can you change the inserted value in one of the columns in AFTER insert trigger code?

This is not possible as the column values supplied by the insert SQL query are already inserted into the table. If you try to assign new value to the column in AFTER insert trigger code then oracle error would be raised. To alter any values supplied by insert SQL query create BEFORE insert trigger.

Q. Explain use of SYSDATE and USER keywords.

SYSDATE is a pseudo column and refers to the current server system date. USER is a pseudo column and refers to the current user logged onto the oracle session. These values come handy when you want to monitor changes happening to the table.



Q. What is the difference between explicit cursor and implicit cursor?

When a single insert, delete or update statement is executed within PL/SQL program then oracle creates an implicit cursor for the same, executes the statement, and closes the cursor. You can check the result of execution using SQL%ROWCOUNT function.

Explicit cursors are created programmatically. The cursor type variable is declared and associated with SQL query. The program then opens a cursor, fetches column information into variables or record type variable, and closes cursor after all records are fetched. To check whether cursor is open or not use function SQL%ISOPEN and to check whether there are any records to be fetched from the cursor use function SQL%FOUND.


Q. Why does a query in Oracle run faster when ROWID is used as a part of the where clause?

ROWID is the logical address of a row - it is not a physical column. It is composed of file number, data block number and row number within data block. Therefore I/O time is minimized retrieving the row, resulting in a faster query.

Q. What type of exception will be raised in the following situations:

a> select..into statement returns more than one row.

b> select..into statement does not return any row.

c> insert statement inserts a duplicate record.

The errors returned are:
a> TOO_MANY_ROWS

b> NO_DATA_FOUND

c> DUP_VAL_ON_INDEX

18 Apr 2013

Using Gotoxy(position) and text color in Dev c++ Editor....

Using Gotoxy(position) and text color in Dev c++ Editor....


#include"stdio.h"
#include"iostream"
#include"conio.h"
#include"windows.h"

using namespace std;
HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE);
COORD CursorPosition;

void gotoxy(int x, int y)
{
CursorPosition.X = x;
CursorPosition.Y = y;
SetConsoleCursorPosition(console,CursorPosition);
}

void settextcolor(int color)
{
    HANDLE h;
    h=GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleTextAttribute(h,color); 
}
int main()
{
gotoxy(15,5);
settextcolor(6);
cout<<"This Blog is AwesomE.";
return 0;
}

Oracle's Pl/SQL Commands and Queries

Oracle's Pl/SQL Commands and Queries




 Create a Procedure:

A procedure is created with the CREATE OR REPLACE PROCEDURE statement. The simplified syntax for the CREATE OR REPLACE PROCEDURE statement is as follows:
CREATE [OR REPLACE] PROCEDURE procedure_name
[(parameter_name [IN | OUT | IN OUT] type [, ...])]
{IS | AS}
BEGIN
  < procedure_body >
END procedure_name;
Where,
  • procedure-name specifies the name of the procedure.
  • [OR REPLACE] option allows modifying an existing procedure.
  • The optional parameter list contains name, mode and types of the parameters. IN represents that value will be passed from outside and OUT represents that this parameter will be used to return a value outside of the procedure.
  • procedure-body contains the executable part.
  • The AS keyword is used instead of the IS keyword for creating a standalone procedure.
Example:
The following example creates a simple procedure that displays the string 'Hello World!' on the screen when executed.
CREATE OR REPLACE PROCEDURE greetings
AS
BEGIN
   dbms_output.put_line('Hello World!');
END;
/
When above code is executed using SQL prompt, it will produce the following result:
Procedure created.
Executing a Procedure
A procedure can be called in two ways:
  • Using the EXECUTE keyword
  • Calling the name of the procedure from a PL/SQL block
The above procedure named 'greetings' can be called with the EXECUTE keyword as:
EXECUTE greetings;
The above call would display:
Hello World

PL/SQL procedure successfully completed.
The procedure can also be called from another PL/SQL block:
BEGIN
   greetings;
END;
/
The above call would display:
Hello World

PL/SQL procedure successfully completed.
Deleting a Procedure:
A procedure is deleted with the DROP PROCEDURE statement. Syntax for deleting a procedure is:
DROP PROCEDURE procedure-name;
So you can drop greetings procedure by using the following statement:
BEGIN
   DROP PROCEDURE greetings;
END;
/

Creating a Function:

A function is created using the CREATE FUNCTION statement. The simplified syntax for the CREATE OR REPLACE PROCEDURE statement is as follows:
CREATE [OR REPLACE] FUNCTION function_name
[(parameter_name [IN | OUT | IN OUT] type [, ...])]
RETURN return_datatype
{IS | AS}
BEGIN
   < function_body >
END [function_name];

Where,
·         function-name specifies the name of the function.
·         [OR REPLACE] option allows modifying an existing function.
·         The optional parameter list contains name, mode and types of the parameters. IN represents that value will be passed from outside and OUT represents that this parameter will be used to return a value outside of the procedure.
·         The function must contain a return statement.
·         RETURN clause specifies that data type you are going to return from the function.
·         function-body contains the executable part.
·         The AS keyword is used instead of the IS keyword for creating a standalone function.

Example:

The following example illustrates creating and calling a standalone function. This function returns the total number of CUSTOMERS in the customers table. We will use the CUSTOMERS table which we had created in PL/SQL Variables chapter:
Select * from emp;
 
+----+----------+-----+-----------+----------+
| ID | NAME     | AGE | ADDRESS   | SALARY   |
+----+----------+-----+-----------+----------+
|  1 | Ramesh   |  32 | Ahmedabad |  2000.00 |
|  2 | Khilan   |  25 | Delhi     |  1500.00 |
|  3 | kaushik  |  23 | Kota      |  2000.00 |
|  4 | Chaitali |  25 | Mumbai    |  6500.00 |
|  5 | Hardik   |  27 | Bhopal    |  8500.00 |
|  6 | Komal    |  22 | MP        |  4500.00 |
+----+----------+-----+-----------+----------+
CREATE OR REPLACE FUNCTION empall
RETURN number IS
   total number(2) := 0;
BEGIN
   SELECT count(*) into total
   FROM emp;
   
   RETURN total;
END;
/

 

 

Package:

A package will have two mandatory parts:
·         Package specification
·         Package body or definition

Package Specification:

The specification is the interface to the package. It just DECLARES the types, variables, constants, exceptions, cursors, and subprograms that can be referenced from outside the package. In other words, it contains all information about the content of the package, but excludes the code for the subprograms.
All objects placed in the specification are called public objects. Any subprogram not in the package specification but coded in the package body is called a private object.
The following code snippet shows a package specification having a single procedure. You can have many global variables defined and multiple procedures or functions inside a package.
CREATE PACKAGE emp_sal AS
   PROCEDURE find_sal(empid emp.id%type);
END emp_sal;
/
When the above code is executed at SQL prompt, it produces following result:
Package created.

Package Body:

The package body has the codes for various methods declared in the package specification and other private declarations, which are hidden from code outside the package.
The CREATE PACKAGE BODY Statement is used for creating the package body. The following code snippet shows the package body declaration for the cust_sal package created above. I assumed that we already have CUSTOMERS table created in our database as mentioned in PL/SQL - Variables chapter.
CREATE OR REPLACE PACKAGE BODY emp_sal AS
   PROCEDURE find_sal(empid emp.id%TYPE) IS
   emp_sal emp.salary%TYPE;
   BEGIN
      SELECT salary INTO emp_sal
      FROM emp
      WHERE id = emp_id;
      dbms_output.put_line('Salary: '|| emp_sal);
   END find_sal;
END emp_sal;
/
When the above code is executed at SQL prompt, it produces following result:
Package body created.

Using the Package Elements

The package elements ( variables, procedures or functions) are accessed with the following syntax:
package_name.element_name;
Consider, we already have created above package in our database schema, the following program uses the find_sal method of the cust_sal package:
DECLARE
   code emp.id%type := &emp_id;
BEGIN
   cust_sal.find_sal(code);
END;
/
When the above code is executed at SQL prompt, it prompt to enter customer ID and when you enter an ID, it displays corresponding salary as follows:
Enter value for emp_id: 1
Salary: 3000
 
PL/SQL procedure successfully completed.

Creating Triggers

The Syntax for creating a trigger is:
CREATE [OR REPLACE ] TRIGGER trigger_name 
{BEFORE | AFTER | INSTEAD OF } 
{INSERT [OR] | UPDATE [OR] | DELETE} 
[OF col_name] 
ON table_name 
[REFERENCING OLD AS o NEW AS n] 
[FOR EACH ROW] 
WHEN (condition)  
DECLARE
   Declaration-statements
BEGIN 
   Executable-statements
EXCEPTION
   Exception-handling-statements
END;
Where,
·         CREATE [OR REPLACE] TRIGGER trigger_name : Creates or replace an existing trigger with the trigger_name.
·         {BEFORE | AFTER | INSTEAD OF} : This specifies when the trigger would be executed. The INSTEAD OF clause is used for creating trigger on a view.
·         {INSERT [OR] | UPDATE [OR] | DELETE}: This specifies the DML operation.
·         [OF col_name]: This specifies the column name that would be updated.
·         [ON table_name]: This specifies the name of the table associated with the trigger.
·         [REFERENCING OLD AS o NEW AS n]: This allows you to refer new and old values for various DML statements, like INSERT, UPDATE, and DELETE.
·         [FOR EACH ROW]: This specifies a row level trigger, i.e., the trigger would be executed for each row being affected. Otherwise the trigger will execute just once when the SQL statement is executed, which is called a table level trigger.
·         WHEN (condition): This provides a condition for rows for which the trigger would fire. This clause is valid only for row level triggers.

Example:

To start with, we will be using the CUSTOMERS table we had created and used in the previous chapters:            Select * from emp;
+----+----------+-----+-----------+----------+
| ID | NAME| AGE | ADDRESS| SALARY|
+----+----------+-----+-----------+----------+
|  1 | Ramesh  |  32 | Ahmedabad |  2000.00 |
|  2 | Khilan    |  25 | Delhi     |  1500.00 |
|  3 | kaushik  |  23 | Kota      |  2000.00 |
|  4 | Chaitali  |  25 | Mumbai    |  6500.00 |
|  5 | Hardik   |  27 | Bhopal    |  8500.00 |
|  6 | Komal   |  22 | MP        |  4500.00 |
 
The following program creates a row level trigger for the customers table that would fire for INSERT or
 UPDATE or DELETE operations performed on the CUSTOMERS table. This trigger will display the salary
 difference between
 the old values and new values:
 
CREATE OR REPLACE TRIGGER display_salary_changes
BEFORE DELETE OR INSERT OR UPDATE ON emp
FOR EACH ROW
WHEN (NEW.ID > 0)
DECLARE
   sal_diff number;
BEGIN
   sal_diff := :NEW.salary  - :OLD.salary;
   dbms_output.put_line('Old salary: ' || :OLD.salary);
   dbms_output.put_line('New salary: ' || :NEW.salary);
   dbms_output.put_line('Salary difference: ' || sal_diff);
END;
/
When the above code is executed at SQL prompt, it produces the following result:
Trigger created.

Here following two points are important and should be noted carefully:
·         OLD and NEW references are not available for statement level triggers, rather you can use them for record level triggers.
·         If you want to query the table in the same trigger, then you should use the AFTER keyword, because triggers can query the table or change it again only after the initial changes are applied and the table is back in a consistent state.
·         Above trigger has been written in such a way that it will fire before any DELETE or INSERT or UPDATE operation on the table, but you can write your trigger on a single or multiple operations, for example BEFORE DELETE, which will fire whenever a record will be deleted using DELETE operation on the table.

 

Comments

© 2013-2016 ITTechnocrates. All rights resevered. Developed by Bhavya Mehta