Pages

Thursday, 8 March 2012

sql vs plsql


SQL
PL/SQL
SQL stands for Structured Query
Language, which does not have
procedural programming
capability.

PL/SQL stands for Procedural
Structured Query Language.
Which have advantage over SQL.

SQL is the language that enables
relational database users to
communicate with the database in
a straightforward manner.

PL/SQL is Oracle's procedural
language; it comprises the
standard language of SQL and a
wide array of commands that
enable you to control the
execution of SQL statements
according to different conditions.

Grant/Revoke Privileges in plsql


Grant Privileges on Tables

You can grant users various privileges to tables. These privileges can be any combination of select, insert, update, delete, references, alter, and index. Below is an explanation of what each privilege means.
Privilege
Description
Select
Ability to query the table with a select statement.
Insert
Ability to add new rows to the table with the insert statement.
Update
Ability to update rows in the table with the update statement.
Delete
Ability to delete rows from the table with the delete statement.
References
Ability to create a constraint that refers to the table.
Alter
Ability to change the table definition with the alter table statement.
Index
Ability to create an index on the table with the create index statement.

Data Dictionary in dbms

Data Dictionary

Data dictionary — metadata — system & object privileges — dictionary structure — ``user'' tables - ``all'' tables — ``dba'' tables — ``v$'' tables — frequently used tables — usage examples — exercises — using the dictionary in PL/SQL programs — optional exercise.

Introduction

This document presents Oracle's data dictionary, also called the system catalogue. The data dictionary is the repository of all the meta-data relevant to the objects stored in the database—and also of information concerning the DBMS itself.

uinx command and shell script


Assignment – 1

v  Locate lines that are longer than 100 and smaller than 150 characters using grep.

è grep -c '\{101,150\}' keval.txt

grep `^.\{100,150\}$` keval.txt

v  Merge and sort the contents of files A and B and display the sorted output on the screen.

è cat file1 file2 | sort

Monday, 5 March 2012

SQL Questions and Answers

1.      To see current user name 
 Sql> show user;
2.      Change SQL prompt name 
 SQL> set sqlprompt “Manimara > “
 
Manimara >
 
Manimara >

Core Java interview questions with answers


1.How could Java classes direct program messages to the system console, but error messages, say to a file?
The class System has a variable out that represents the standard output, and the variable err that represents the standard error device. By default, they both point at the system console. This how the standard output could be re-directed:
Stream st = new Stream(new FileOutputStream(“output.txt”)); System.setErr(st); System.setOut(st);
2.How would you create a button with rounded edges?
There’s 2 ways. The first thing is to know that a JButton’s edges are drawn by a Border. so you can override the Button’s paintComponent(Graphics) method and draw a circle or rounded rectangle (whatever), and turn off the border. Or you can create a custom border that draws a circle or rounded rectangle around any component and set the button’s border to it.

Amazing picture