How do u implement the If statement in the Select Statement

1 Answer

Answer :

We can implement the if statement in the select statement by using
the Decode statement. e.g select DECODE
(EMP_CAT,'1','First','2','Second'Null); Here the Null is the else
statement where null is done .

Related questions

Description : How to implement the multiple control files for an existing database ?

Last Answer : Shutdown the database Copy one of the existing control file to new location Edit Config ora file by adding new control file. name Restart the database.

Description : What are roles? How can we implement roles ?

Last Answer : Roles are the easiest way to grant and manage common privileges needed by different groups of database users. Creating roles and assigning provides to roles. Assign each role to group of users. This will simplify the job of assigning privileges to individual users.

Description : How to add conditions in select statement in oracle?

Last Answer : Just add the decode

Description : Can a formula column be obtained through a select statement?

Last Answer : Yes

Description : Can you use select in FROM clause of SQL select ?

Last Answer : Yes.

Description : Suppose a customer table is having different columns like customer no, payments.What will be the query to select top three max payments?

Last Answer : SELECT customer_no, payments from customer C1 WHERE 3

Description : maxvalue.sql Select the Nth Highest value from a table?

Last Answer : select level, max('col_name') from my_table where level = '&n' connect by prior ('col_name') > 'col_name') group by level; Example: Given a table called emp with the following columns: -- id number -- name ... , max(sal) from emp -- where level=2 -- connect by prior sal > sal -- group by level

Description : minvalue.sql Select the Nth lowest value from a table?

Last Answer : select level, min('col_name') from my_table where level = '&n' connect by prior ('col_name') < 'col_name') group by level; Example: Given a table called emp with the following columns: -- id number -- name ... , min(sal) from emp -- where level=2 -- connect by prior sal < sal -- group by level

Description : What a SELECT FOR UPDATE cursor represent.?

Last Answer : SELECT......FROM......FOR......UPDATE[OF column-reference][NOWAIT] The processing done in a fetch loop modifies the rows that have been retrieved by the cursor. A convenient way of ... the FOR UPDATE clause in the cursor declaration, WHERE CURRENT OF CLAUSE in an UPDATE or declaration statement.

Description : How is it possible to select generate a select set for the query in the query property sheet?

Last Answer : By using the tables/columns button and then specifying the table and the column names.

Description : What is a difference between pre-select and pre-query?

Last Answer : Fires during the execute query and count query processing after oracle forms constructs the select statement to be issued, but before the statement is actually issued. The pre-query trigger fires ... the query criteria in enter query mode.Pre-query trigger fires before pre-select trigger.

Description : Select NORTH', CUSTOMER From CUST_DTLS Where REGION = N' Order By CUSTOMER Union Select EAST', CUSTOMER From CUST_DTLS Where REGION = E' Order By CUSTOMER The above is a) Not an error b) Error - ... ' and SOUTH' c) Error - the string should be in double quotes d) Error - ORDER BY clause

Last Answer : d) Error - ORDER BY clause

Description : Can you audit SELECT statements?

Last Answer : YES. But beware; you will need a storage mechanism to hold your SQL SELECT audits, a high data volume that can exceed the size of your whole database, every day. SQL SELECT auditing can be ... data in the audit trail must also be audited to see who has selected data from the audit trail.

Description : SQL> SELECT * FROM MY_SCHEMA.MY_TABLE; SP2-0678: Column or attribute type cannot be displayed by SQL*Plus Why I’m getting this error?

Last Answer : The table has a BLOB column.

Description : Will a user be able to modify a table with SELECT only privilege?

Last Answer : He won’t be able to UPDATE/INSERT into that table, but for some reason, he will still be able to lock a certain table.

Description : Can u run the report with out a parameter form

Last Answer : Yes it is possible to run the report without parameter form by setting the PARAM value to Null

Description : Can u have more than one layout in report

Last Answer : It is possible to have more than one layout in a report by using the additional layout option in the layout editor.

Description : Can u change the mouse pointer ? How?

Last Answer : Yes. Specifies the mouse cursor style. Use this property to dynamically change the shape of the cursor.

Description : Can u have VBX and OCX controls in forms ?

Last Answer : Yes.

Description : Can u have OLE objects in forms?

Last Answer : Yes.

Description : Can u set default font in forms?

Last Answer : Yes. Change windows registry(regedit). Set form45_font to the desired font.

Description : Can u change VAT at run time?

Last Answer : Yes. You can programmatically change an object's named visual attribute setting to change the font, color, and pattern of the object at runtime.

Description : Can u port applictions across the platforms? how?

Last Answer : Yes we can port applications across platforms.Consider the form developed in a windows system.The form would be generated in unix system by using f45gen my_form.fmb scott/tiger

Description : Can U disable database trigger? How?

Last Answer : Yes. With respect to table ALTER TABLE TABLE [[ DISABLE all_trigger ]]

Description : Which of the following statements about the Crime and Criminal Tracking Network System (CCTNS) is/are correct? 1. It will facilitate real time access of classified criminal data to the law enforcement authorities. 2. National Crime ... below- 1) 1 only 2) 2 only 3) Both 1 and 2 4) Neither 1 nor 2

Last Answer : 1) 1 only

Description : When will Canada and The U.S. have to implement Austerity measures?

Last Answer : Luckily we waste so much money on the military we can slash the fuck out of that for a long time before people will care. No need to cut social programs while the Pentagon bankrupts the country.

Description : What are the types of SQL Statement ?

Last Answer : Data Definition Language : CREATE,ALTER,DROP,TRUNCATE,REVOKE,NO AUDIT & COMMIT.

Description : Can you use a commit statement within a database trigger?

Last Answer : No

Description : What will happen after commit statement ?

Last Answer : Cursor C1 is Select empno, ename from emp; Begin open C1; loop Fetch C1 into eno.ename; Exit When C1 %notfound;----- commit; end loop; end; The cursor having query as SELECT .... FOR ... after COMMIT/ROLLBACK. The cursor having query as SELECT.... does not get closed even after COMMIT/ROLLBACK.

Description : What is Statement Auditing ?

Last Answer : Statement auditing is the auditing of the powerful system privileges without regard to specifically named objects.

Description : Can you see Execution Plan of a statement?

Last Answer : YES. In many ways, for example from GUI based tools like TOAD, Oracle SQL Developer. Configuring AUTOTRACE, a SQL*Plus facility AUTOTRACE is a facility within SQL*Plus to show us the explain plan of the ... - Like SET AUTOTRACE ON, but suppresses the printing of the user's query output, if any.

Description : Point out the correct statement. a) Mapper maps input key/value pairs to a set of intermediate key/value pairs b) Applications typically implement the Mapper and Reducer interfaces to provide the map and ... methods c) Mapper and Reducer interfaces form the core of the job d) None of the mentioned

Last Answer : None of the mentioned

Description : Point out the wrong statement. a) A MapReduce job usually splits the input data-set into independent chunks which are processed by the map tasks in a completely parallel manner b) The ... implement the Mapper and Reducer interfaces toprovide the map and reduce methods d) None of the mentioned

Last Answer : None of the mentioned

Description : Which statement is true? a. Increasing in capacity and changes in automation can take less than a year to implement if the product already exists. Sales of capacity take a full year to implement ... automation and sales of capacity take less than a year to implement if the product already exists.

Last Answer : b. Increases in capacity and changes in automation take a full year to implement. Sales of capacity are immediate.

Description : What does "jumps off the screen" mean?

Last Answer : answer:AMD is a relatively small manufacturer but well established in the industry. In this context, AMD jumps off the screen at the guy doing the research into acquiring companies for ... chip manufacturing division, but AMD is the one that really stands out from an acquisition perspective.

Description : How can I dump an oracle schema to a LOCAL file over a network connection from sqlplus?

Last Answer : By connecting and spooling are you excluding the exp/imp commands (or expdb/impdb in 10g)?

Description : What are the two ways to incorporate images into a oracle forms application?

Last Answer : Boilerplate Images Image_items

Description : Can one export a subset of a table? (for DBA

Last Answer : From Oracle8i one can use the QUERY= export parameter to selectively unload a subset of the data from a table. Look at this example: exp scott/tiger tables=emp query=\"where deptno=10\"

Description : What are the types of visual attribute settings?

Last Answer : Custom Visual attributes Default visual attributes Named Visual attributes. Window

Description : How does one use the import/export utilities? (for DBA

Last Answer : Look for the "imp" and "exp" executables in your $ORACLE_HOME/bin directory. One can run them interactively, using command line parameters, or using parameter files. Look at the imp/exp parameters ... and export data with the "Schema Manager" GUI that ships with Oracle Enterprise Manager (OEM).

Description : what is a display item?

Last Answer : Display items are similar to text items but store only fetched or assigned values. Operators cannot navigate to a display item or edit the value it contains.

Description : What is import/export and why does one need it? (for DBA

Last Answer : The Oracle export (EXP) and import (IMP) utilities are used to perform logical database backup and recovery. They are also used to move Oracle data from one machine, database or schema to ... corruption. Ensure that all the data can be read. . Transporting tablespaces between databases . Etc.

Description : Are there any troubleshooting tips for OEM? (for DBA

Last Answer : . Create the OEM repository with a user (which will manage the OEM) and store it in a tablespace that does not share any data with other database users. It is a bad practice to create ... successfully. Check the log to see the results of the execution rather than relying on this status.

Description : Where can one get more information about TCL? (for DBA

Last Answer : One can write custom event checking routines for OEM using the TCL (Tool Command Language) language. Check the following sites for more information about TCL: . The Tcl Developer Xchange - ... the OraTCL package . Tom Poindexter's Tcl Page - Oratcl was originally written by Tom Poindexter

Description : How does one start the Oracle Intelligent Agent? (for DBA

Last Answer : One needs to start an OIA (Oracle Intelligent Agent) process on all machines that will to be managed via OEM. For OEM 9i and above:

Description : What is the Oracle Intelligent Agent? (for DBA

Last Answer : The Oracle Intelligent Agent (OIA) is an autonomous process that needs to run on a remote node in the network to make the node OEM manageable. The Oracle Intelligent Agent is ... events registered in Enterprise Manager; and . Executing tasks associated with jobs submitted to Enterprise Manager.

Description : How does one backout events and jobs during maintenance slots? (for DBA

Last Answer : Managemnet and data collection activity can be suspended by imposing a blackout. Look at these examples: agentctl start blackout # Blackout the entrire agent agentctl stop blackout # Resume normal monitoring ... management agentctl start blackout -s jobs -d 00:20 # Blackout jobs for 20 minutes

Description : What are the pre requisites ?

Last Answer : I. to modify data type of a column ? ii. to add a column with NOT NULL constraint ? To Modify the datatype of a column the column must be empty. to add a column with NOT NULL constrain, the table must be empty.

Description : What kind of jobs can one schedule with OEM? (for DBA

Last Answer : OEM comes with pre-defined jobs like Export, Import, run OS commands, run sql scripts, SQL*Plus commands etc. It also gives you the flexibility of scheduling custom jobs written with the TCL language.

Description : Difference between SUBSTR and INSTR ?

Last Answer : INSTR (String1,String2(n,(m)),INSTR returns the position of the mth occurrence of the string 2 instring1. The search begins from nth position of string1.SUBSTR (String1 n,m)SUBSTR returns a character string of size m in string1, starting from nth position of string1.