Simple scott/tiger query in horizontal format
Hi Guys, this is my first thread to this forum, as I m a java developer and does not come across sql frequently.
I have a simple requirement.
I ll need this example to let u know, what is all I need.
You must be very well aware of the famous scott/tiger schema in Oracle database where the emp table has a many-one relationship with dept table.
Is there any way, where I can get the data in the below format (assuming one dept will have maximum 4 employees and minimum 0 employees)
DeptNo Employee1 Employee2 Employee3 Employee4
Accounting CLARK KING MILLER Null
Research JONES SCOTT ADAMS FORD
Sales ALLEN WARD NULL NULL
thanks in advance,
Abzee
Hi, Abzee,
Welcome to the forum!
That's called a Pivot and here's one way to do it:
WITH got_rnum AS
SELECT deptno
, ename
, ROW_NUMBER () OVER ( PARTITION BY deptno
ORDER BY ename
) AS rnum
FROM scott.emp
SELECT d.dname
, MIN (CASE WHEN r.rnum = 1 THEN r.ename END) AS employee1
, MIN (CASE WHEN r.rnum = 2 THEN r.ename END) AS employee2
, MIN (CASE WHEN r.rnum = 3 THEN r.ename END) AS employee3
, MIN (CASE WHEN r.rnum = 4 THEN r.ename END) AS employee4
FROM scott.dept d
JOIN got_rnum r ON r.deptno = d.deptno
GROUP BY d.dname
;To do a pivot, you must have columns or expressions that tell what row and column of the output correspond to each row of the input.
In this example, d.dname uniquely identifies the row of the output, but there's nothing that says that 'JONES' belongs in the employee1 column rather than the employee2 column. I used ROW_NUMBER to assign each employee a number, starting with 1 in each deptartment, for just that reason. I used ORDER BY ename, so that the employees will appear in alphabetic order. You could use any other way of sorting them (e.g., by salary or descending hiredate).
This site normally compresses multiple spaces into one space.
To post formatted text, such as your desired reuslts, type these 6 characters:
(all small letters, inside curly brackets) before and after the formatted sections.
Similar Messages
-
How to retrieve a SQL query (in String format) from a PreparedStatement
Hello all,
I am in the process of unit testing an application accessing a Oracle 9i 9.2 RDBMS server with JDBC.
My query is:
As I have access to PreparedStatement and CallableStatement Java objets but not to the source queries which help create those objects?
Is thtere a simple way by using an API, to retrieve the SQL command (with possible ? as placeholders for parameters).
I have already looked at the API documentation for those two objets (and for the Statement and ResultSetmetaData objects too) but to no avail.
Thank you for any help on this issue,
Best regards,
BenoîtSorry for having wasted your time... and for not understanding what you meant in your first reply.
But the codlet was only to show the main idea:
Here is the code which compiles OK for this approach to reach its intended goal:
main class (file TestSuiteClass.java):
import java.sql.*;
import static java.lang.Class.*;
* Created by IntelliJ IDEA.
* User: bgilon
* Date: 15/03/12
* Time: 10:05
* To change this template use File | Settings | File Templates.
public class TestSuiteClass {
public static void main(final String[] args) throws Exception {
// Class.forName("oracle.jdbc.OracleDriver");
final Connection mconn= new mConnection(
DriverManager.getConnection("jdbc:oracle:thin:scott/tiger@host:port:service"));
* final Statement lstmt= TestedClass.TestedMethod(mconn, ...);
* final String SqlSrc= mconn.getSqlSrc(lstmt).toUpperCase(), SqlTypedReq= mconn.getTypReq(lstmt);
* assertEquals("test 1", "UPDATE IZ_PD SET FIELD1= ? WHERE FIELDPK= ?", SqlSrc);
Proxy class (file mConnector.java):
import java.sql.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Properties;
* Created by IntelliJ IDEA.
* User: bgilon
* Date: 15/03/12
* Time: 10:05
* To change this template use File | Settings | File Templates.
* This file should be compiled with JDK 1.6, but can be used with previous JDK versions.
* See OKwith1pN booleans usage for not throwing Exceptions as Unknown methods by the conn object...
public final class mConnection implements Connection {
private final Connection conn;
private final List<Statement> Stmts= new ArrayList<Statement>();
private final List<String> SqlSrcs= new ArrayList<String>();
private final List<Integer> TypSrcs= new ArrayList<Integer>();
private final static String jvmv= System.getProperty("java.specification.version");
private static final boolean OKwith1p2;
private static final boolean OKwith1p4; /* OKwith1p5, */
private static final boolean OKwith1p6;
static {
/* jvmv= System.getProperty("java.version");
System.out.println("jvmv = " + jvmv);
jvmv= System.getProperty("java.vm.version");
System.out.println("jvmv = " + jvmv); */
System.out.println("jvmv = " + jvmv);
OKwith1p2= (jvmv.compareTo("1.2") >= 0);
OKwith1p4= (jvmv.compareTo("1.4") >= 0);
// OKwith1p5= (jvmv.compareTo("1.5") >= 0);
OKwith1p6= (jvmv.compareTo("1.6") >= 0);
public String getSqlSrc(final Statement pstmt) {
int ix= 0;
for(Statement stmt : this.Stmts) {
if(stmt == pstmt) return SqlSrcs.get(ix);
ix+= 1;
return null;
static private final String[] TypeNames= new String[] { "Statement", "PreparedStatement", "CallableStatement" };
public String getTypReq(final Statement pstmt) {
int ix= 0;
for(Statement stmt : this.Stmts) {
if(stmt == pstmt) return TypeNames[TypSrcs.get(ix)];
ix+= 1;
return null;
private void storedStatement(
final Statement stmt,
final String sqlSrc,
final Integer typReq
Stmts.add(stmt);
SqlSrcs.add(sqlSrc);
TypSrcs.add(typReq);
public Connection getDecoratedConn() {
return conn;
mConnection(final Connection pconn) {
this.conn= pconn;
public boolean isClosed() throws SQLException {
return conn.isClosed();
public void rollback(Savepoint savepoint) throws SQLException {
if(OKwith1p4) conn.rollback(savepoint);
public boolean isReadOnly() throws SQLException {
return conn.isReadOnly();
public int getTransactionIsolation() throws SQLException {
return conn.getTransactionIsolation();
public void setTransactionIsolation(int level)throws SQLException {
conn.setTransactionIsolation(level);
public Properties getClientInfo() throws SQLException {
return OKwith1p6 ? conn.getClientInfo() : null;
public <T> T unwrap(Class<T> iface)
throws SQLException {
return conn.unwrap(iface);
public void setAutoCommit(boolean auto) throws SQLException {
conn.setAutoCommit(auto);
public boolean getAutoCommit() throws SQLException {
return conn.getAutoCommit();
public Map<String,Class<?>> getTypeMap() throws SQLException {
if(!OKwith1p2) return null;
return conn.getTypeMap();
public void setTypeMap(Map<String,Class<?>> map) throws SQLException {
if(!OKwith1p2) return;
conn.setTypeMap(map);
public void setHoldability(final int holdability) throws SQLException {
if(OKwith1p4) conn.setHoldability(holdability);
public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
return conn.createStruct(typeName, attributes);
public void commit() throws SQLException {
conn.commit();
public void rollback() throws SQLException {
conn.rollback();
public boolean isValid(int timeout) throws SQLException {
return OKwith1p6 && conn.isValid(timeout);
public void clearWarnings() throws SQLException {
conn.clearWarnings();
public int getHoldability() throws SQLException {
if(!OKwith1p4) return -1;
return conn.getHoldability();
public Statement createStatement() throws SQLException {
return conn.createStatement();
public PreparedStatement prepareStatement(final String SqlSrc) throws SQLException {
if(!OKwith1p2) return null;
final PreparedStatement lstmt= conn.prepareStatement(SqlSrc);
storedStatement(lstmt, SqlSrc, 1);
return lstmt;
public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException {
if(!OKwith1p4) return null;
final PreparedStatement lstmt= conn.prepareStatement(sql, columnNames);
storedStatement(lstmt, sql, 1);
return lstmt;
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
final PreparedStatement lstmt= conn.prepareStatement(sql, resultSetType, resultSetConcurrency);
storedStatement(lstmt, sql, 1);
return lstmt;
public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException {
final PreparedStatement lstmt= conn.prepareStatement(sql, columnIndexes);
storedStatement(lstmt, sql, 1);
return lstmt;
public void setClientInfo(String name, String value) throws SQLClientInfoException {
if(OKwith1p6)
conn.setClientInfo(name, value);
public PreparedStatement prepareStatement(final String SqlSrc,
int resultType,
int resultSetCurrency,
int resultSetHoldability) throws SQLException {
final PreparedStatement lstmt= conn.prepareStatement(SqlSrc, resultType, resultSetCurrency);
storedStatement(lstmt, SqlSrc, 1);
return lstmt;
public PreparedStatement prepareStatement(final String SqlSrc,
int autogeneratedkeys) throws SQLException {
if(!OKwith1p4) return null;
final PreparedStatement lstmt= conn.prepareStatement(SqlSrc, autogeneratedkeys);
storedStatement(lstmt, SqlSrc, 1);
return lstmt;
public CallableStatement prepareCall(final String SqlSrc) throws SQLException {
final CallableStatement lstmt= conn.prepareCall(SqlSrc);
storedStatement(lstmt, SqlSrc, 2);
return lstmt;
public CallableStatement prepareCall(final String SqlSrc,
int resultType,
int resultSetCurrency,
int resultSetHoldability) throws SQLException {
if(!OKwith1p4) return null;
final CallableStatement lstmt= conn.prepareCall(SqlSrc, resultType, resultSetCurrency, resultSetHoldability);
storedStatement(lstmt, SqlSrc, 2);
return lstmt;
public Array createArrayOf(String typeName, Object[] elements) throws SQLException {
return OKwith1p6 ? conn.createArrayOf(typeName, elements) : null;
public CallableStatement prepareCall(final String SqlSrc,
int resultType,
int resultSetCurrency) throws SQLException {
if (!OKwith1p2) return null;
final CallableStatement lstmt= conn.prepareCall(SqlSrc, resultType, resultSetCurrency);
storedStatement(lstmt, SqlSrc, 2);
return lstmt;
public SQLXML createSQLXML() throws SQLException {
return OKwith1p6 ? conn.createSQLXML() : null;
public DatabaseMetaData getMetaData() throws SQLException {
return conn.getMetaData();
public String getCatalog() throws SQLException {
return conn.getCatalog();
public void setCatalog(final String str) throws SQLException {
conn.setCatalog(str);
public void setReadOnly(final boolean readonly) throws SQLException {
conn.setReadOnly(readonly);
public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
return conn.createStatement(resultSetType, resultSetConcurrency, resultSetHoldability);
public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException {
if(!OKwith1p2) return null;
return conn.createStatement(resultSetType, resultSetConcurrency);
public String nativeSQL(final String sql) throws SQLException {
return conn.nativeSQL(sql);
public void releaseSavepoint(Savepoint savepoint) throws SQLException {
if(OKwith1p4) conn.releaseSavepoint(savepoint);
public Savepoint setSavepoint() throws SQLException {
return OKwith1p4 ? conn.setSavepoint() : null;
public Savepoint setSavepoint(final String str) throws SQLException {
return OKwith1p4 ? conn.setSavepoint(str) : null;
public boolean isWrapperFor(Class iface) throws SQLException {
return conn.isWrapperFor(iface);
public String getClientInfo(final String str) throws SQLException {
return OKwith1p6 ? conn.getClientInfo(str) : null;
public void setClientInfo(final Properties pro) throws SQLClientInfoException {
if (OKwith1p6) conn.setClientInfo(pro);
public Blob createBlob() throws SQLException {
return OKwith1p6 ? conn.createBlob() : null;
public Clob createClob() throws SQLException {
return OKwith1p6 ? conn.createClob() : null;
public NClob createNClob() throws SQLException {
return OKwith1p6 ? conn.createNClob() : null;
public SQLWarning getWarnings() throws SQLException {
return conn.getWarnings();
public void close() throws SQLException {
conn.close();
Final word:
The final word about this is: there is currently three ways to obtain source SQL queries from compiled statement objects.
a) Use a proxy class the mConnector above;
b) Use a proxy JDBC driver as Log4JDBC;
c) Use the trace facility of the driver (however, post analyzing the logs would depend upon the driver selected).
Thank you for reading,
Benoît -
Can we generate the output of SQL Query in XML format ..
Hi Team,
Can we generate an XML doc for an SQL Query.
I've seen in SQL Server 2000.It is generating the output of an SQL Query in xml format.
select * from emp for xml auto
The output looks like
<emp EMPNO="7369" ENAME="SMITH" JOB="CLERK" MGR="7902" HIREDATE="1980-12-17T00:00:00" SAL="2800" DEPTNO="20"/><emp EMPNO="7370" ENAME="SMITH" JOB="CLERK" MGR="7902" HIREDATE="1980-12-17T00:00:00" SAL="2800" DEPTNO="10"/>Just a little bit of short hand.
Get the XML out of your database, via HTTP
Of course the easiest method is just to return an XMLType from a stored procedure and let the calling routine figure out what to do with it. Instead
of that way though, I'll show you how to do it via HTTP. It's all completely built into 10g and is super easy to use.
CREATE OR REPLACE VIEW emps_and_depts AS
SELECT e.employee_id AS "EmployeeId",
e.last_name AS "Name",
e.job_id AS "Job",
e.manager_id AS "Manager",
e.hire_date AS "HireDate",
e.salary AS "Salary",
e.commission_pct AS "Commission",
XMLFOREST (
d.department_id AS "DeptNo",
d.department_name AS "DeptName",
d.location_id AS "Location"
) AS "Dept"
FROM employees e, departments d
WHERE e.department_id = d.department_id
Some people hear web and immediately start salivating about security issues. Let me address that quickly. Just because you have the HTTP and/or
FTP servers running in the database, that does not mean you have a security problem. For one, I would hope your databases are behind a firewall.
Second, with the correct architecture (DMZ, app servers, etc) you can make this data available outside the firewall fairly transparently and third,
just because it's on the web does not mean the data MUST be available on the internet. This is a good way to make your data available on your
intranet. If you are worried about people INSIDE your firewall, that still doesn't preclude web based access. Follow Oracle security guidelines.
Before I show you how to get to your data, let's talk about URLs and URIs. A URL is a Uniform Resource Locater and URI is a Uniform Resource
Identifier. A URL is the way you would identify a document on the net, i.e. http://www.oracle.com is a URL. A URI is a more generic form of a URL.
Oracle supports three types of URI: HTTPURIType - basically a URL (which would be like the URL above), XDURIType - a pointer to an XDB resource
(usually an XML document but can be other objects), and DBURIType - a pointer to database objects.
It's the DBURIType that we're going to concentrate on here. The DBURIType let's us reference database objects using a file/folder paradigm. The
format for a DBURI is /oradb/<schema>/<table>. Oradb is shorthand for the database; it is not the database name or SID. My database is named XE
but I still use oradb in the DBURI. For example, the view we created above is in my XE database, is owned by HR (at least in my case) and is called
EMPS_AND_DEPTS. This can be referenced as /oradb/HR/EMPS_AND_DEPTS.
If the view had many rows and you wanted only one of them, you can restrict it by including a predicate. The documentation for XDB has a great
write up on Using DBURIs.In our case, we are going to write out the entire document. Now that you understand that the DBURI is a pointer to
objects in our instance, we can use that to access the data as a URL.
The format for the URL call is http://<machinename>:<port>/<DBURI>
In my case, my XE database is running on a machine called mach1 and is listening on port 8080. So to see the view we created above, I open my
browser and navigate to: http//mach1:8080/oradb/HR/EMPS_AND_DEPTS
The created URL will be as http//mach1:8080/oradb/PUBLIC/EMPS_AND_DEPTS
If your database is set up correctly and listening on port 8080 (the default), your browser should ask you to login. Login as the user who created the
view (in my case HR). You should now get an XML document displayed in your browser.
And that's it. It doesn't get much simpler than that. If you get rid of the descriptive text above, it basically comes down to:
Create a table or view
Open your web browser
Enter a URL
Enter a user ID and password
View your XML
If you notice, Oracle formatted the data as XML for us. Our view returns scalar columns and an XML fragment called Dept. Oracle formatted the
return results into an XML format.
And as a side note, if you look closely, you'll see that my URL has PUBLIC where I said to put HR. PUBLIC is a synonym for all objects that your
logged in user can see. That way, if your user has been granted select access on many schemas, you can use PUBLIC and see any of them. -
Is there a way to edit a movie clip from the horizontal format to a vertical format?
Is there a way to edit a movie clip in iphoto that I may change the horizontal format to a verticle format?
You need to use a video editor like iMovie or QuicktimePro. OR an app like this:
https://www.macupdate.com/app/mac/39994/video-rotate -
How do I save a PDF as an excel file when the PDF is horizontal. Adobe tries to rotate the page, but the data is entered in an horizontal format.
Thanks for the quick reply. I figured out how to get the desired results by using tagging. For anyone who may reference this post in the future, I went to "Customize" in the top right corner of Adobe, then selected "Create new tool set...", looked under "accessiblity and found the "tag" option. Hit ok, tag is added to the toolbar. Then I highlighted the dataset in the PDF that was relevant to the output format, then clicked "tag", saved as spreadsheet. Sorry I can't provide more details on how tagging works or if there's a more elegant solution available, but I'm sure one's out there.
-
How to Output data in vertically from a horizontal format.
Hello
I have some difficulties how to display my data in my output table. I am greatful for
every tips provided. The data in my it_tab is in a horizontal format but I want to
display this data vertically in my output_tab.
My it_tab looks like this:
table: it_tab
id date amnt
011 2007 1200
011 2008 1400
011 2009 6700
011 2010 3500
012 2007 ---
013 2007 3000
013 2008 1300
014 2007 1200
014 2008 ---
014 2009 9000
015 2007 2500
I would like my output_tab should look like this:
table: t_output
id name date amnt date1 amnt1 date2 amnt2 date3 amnt3
011 jx 2007 1200 2008 1400 2009 6700 2010 3500
012 tx --
014 gx 2007 3000 2008 -- 2009 9000 -- ---
015 hx 2007 2500
t_output already has some data init like id and name.
This is what I have done but I don't output all the data as I want.
clear w_output.
loop at t_output into w_output.
clear w_itab.
loop at it_tab into w_itab where id = w_output-id.
case sy-tabix.
WHEN '1'.
w_output-date = w_itab-date.
w_output-amnt = w_itab-amnt.
WHEN '2'.
w_output-date1 = w_itab-date.
w_output-amnt1 = w_itab-amnt.
WHEN '3'.
w_output-date2 = w_itab-date.
w_output-amnt2 = w_itab-amnt.
WHEN '4'.
w_output-date3 = w_itab-date.
w_output-amnt3 = w_itab-amnt.
endcase.
endloop.
modify t_output from w_output.
endloop.
Could some body please tell me how to do this? I think many people in here have come
across this type of problem before.
Thank you all for helping out.
NadinHi, Nadin!
I suggest you to create a dynamic internal table with variable number of columns. You can do as follows:
1. Create basic fieldcatalog for ALV list (or object) output
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING i_structure_name = 'ZYOUR_BASIC_STRUC'
CHANGING ct_fieldcat = lt_fcat.
2. Determine max number of columns (that is, max number of dates for each ID)
SORT it_tab BY id.
LOOP AT it_tab INTO is_tab.
AT NEW id.
ADD 1 TO l_count.
ENDAT.
AT END OF id.
IF l_count > l_max_count.
l_max_count = l_count.
ENDIF.
CLEAR l_count.
ENDAT.
ENDLOOP.
3. Add one entry to fieldcat for each column
DO l_max_count TIMES.
l_index_char = sy-index.
CONCATENATE 'DATE' l_index_char INTO ls_fcat-fieldname.
*... other fieldcat fields, like texts etc.
APPEND ls_fcat TO lt_fcat.
CONCATENATE 'AMNT' l_index_char INTO ls_fcat-fieldname.
*... other fieldcat fields, like texts etc.
APPEND ls_fcat TO lt_fcat.
ENDDO.
4. Create dynamic table from fieldcat using:
DATA: dt_outtab TYPE REF TO data. "IMPORTANT: make this declaration global, otherwise error
FIELD-SYMBOLS: <table> TYPE STANDARD TABLE.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING it_fieldcatalog = lt_fcat
IMPORTING ep_table = dt_outtab.
ASSIGN dt_outtab->* TO <table>.
5. Fill this table. To do this you need special techniques since you have a generic table with no static structure. For example:
FIELD-SYMBOLS: <line> TYPE ANY,
<field> TYPE ANY.
DATA: l_field_inex TYPE i.
LOOP AT it_tab INTO is_tab.
AT NEW id.
APPEND INITIAL LINE TO <table>.
READ TABLE <table> INDEX sy-tfill ASSIGNING <line>.
l_field_index = 3. "you start from 3rd field - #1 is ID, #2 is NAME
ENDAT.
ASSIGN COMPONENT l_field_index OF STRUCUTRE <line> TO <field>.
<field> = is_tab-date.
ADD 1 TO l_field_index.
ASSIGN COMPONENT l_field_index OF STRUCUTRE <line> TO <field>.
<field> = is_tab-amnt.
ADD 1 TO l_field_index.
ENDLOOP.
6. Display your report in alv. You have valid fieldcat and output table which is created dynamically.
CALL METHOD o_alv->set_table_for_first_display
CHANGING it_outtab = <table>
it_fieldcatalog = lt_fcat.
If you don't use ALV object but rather ALV list, it's similar. Just use corresponding functions for ALV creation and list display.
Note that this is not a tested code. Just an idea to help you procede.
<b><REMOVED BY MODERATOR></b>
HTH.
Regards,
Igor
Message was edited by:
Alvaro Tejada Galindo -
hai friends!
I installed D2K recently. Iam unable to login to sql (directly or from D2K forms) using the usual username/password..scott/tiger,system/manager,demo/demo. I get the following error message :
TNS error: Unable to connect to destination
Please help me out!
thanX,
rajiwhat is your error number.
Did you try to look up this number in the oracle error book?
Usually you can also find the solution there.
My bet is that your tnsnames.ora file is not set properly. -
Problem in login with scott/tiger in SQL Plus
Hi,
I want to login with Scott/Tiger in SQL Plus, I have client on my machine, I can connect to any database by entering entry in tnsnames.ora file, but when I try to login with scott/tiger, Protocol adapter error comes, Do I need to enter any thing in tnsnames.ora file? if yes, please tell me the entries,
Thanks
Nidhi..I have modified tnsnames.ora file, Below is this file
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ORCL)
Now i ger error
Error: ORA-12541: TNS: no listener
Regards,
Nidhi.. -
Sql plus not accepting user id and password as scott, tiger resp
Hi, this is mihir shah
I have just installed oracle9i
And I have a problem in opening the sql plus. It asks for user id and pass but when entered scott, tiger it always gives a tns error.
Could you tell me how to make a database & how to log on & how to make a new user id and passwordIt seem that you have problem with network connectivity to you database.
Check the listener status and the configuration of the files: tnsnames.ora & listener.ora
In all cases you must specified the error.
Bye, Aron -
Changing page templates to horizontal format
Is it possible to change existing page templates to a horizontal format, or to create a custom template that is horizontal using either iweb, photoshop or illustrator.
I have tried playing around with the content width and height, but images and text are simply cut off. I have just begun to play around with this and the iweb help hasn't been of much help.
Any advice or tutorial or etc.,. anyone could point me to regarding this would be greatly appreciated! Thanks!
Cheers!
fotobonbonYou appear to know how to adjust the width of a page, it sounds as though height is your problem. Height is not really all that relevent, because whatever height you set your page at, it will resize if you exceed your settings.
That being said, sometimes it won't and it depends on what objects you are using. If you find that pictures etc are cut off because of the height you have set, create an empty text box and move it down the page, this will make the page longer so you can see your pictures. -
Basic SQL queries in Scott/tiger schema...
One of my team member who is a fresher wants to learn SQL.
Access to Scott/tiger is available.
Can some links or queries be posted which can be tried and will be useful to learn SQL.Hi,
Read the following links:
http://download-uk.oracle.com/docs/cd/B19306_01/appdev.102/b14261/toc.htm
http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14200/toc.htm
http://download-uk.oracle.com/docs/cd/B19306_01/appdev.102/b14251/toc.htm
Regards
Avinash -
Connect string for scott/tiger
i've personal oracle 8i with only scott/tiger schema on my pc. i installed forms 6i. when i try to connect to my scott/tiger schema it gives me tns listener error. i'm using scott/tiger as username/password. i tried keeping Host string null and 'ORCL' but no luck....
any help is appreciated
thank you very much
---himanshuHimanshu,
When u have the default database and Oracle Forms on the same machine, from SQL prompt it will connect to the database without any connect string. But when u connect from Forms u NEED to have a TNS entry. Open explorer --> Oracle Home directory --> Network --> Admin and u will find the Tnsnames.ora Open this file and create a new TNS entry ( u will find examples ) Give ur machine IP address/or user name and SID ( which will be ORCL by default ) save this file. Then connect from Forms it will connect. Good luck
orcl.world =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(COMMUNITY = tcp.world)
(PROTOCOL = TCP)
(Host = your machine IP)
(Port = 1521)
(CONNECT_DATA = (SID = ORCL)
now orcl is ur TNS name -
Oracle 11g SQL signon - The scott/tiger routine...
I just installed Oracle 11g.
First, what is the ID/PW into SQL - it used to be scott/tiger. I changed it to what I wanted on install. However, when I logon and type scott then tiger its says
account locked out. I tried scott and my own "created pw". It still didn't let me in. Is there an "easy" fix?
I have to get this aspect going to get to first base. How do I get around this or FIX it????
Walter Earl Roper
University of Illinois
[email protected]By default, most of the demo accounts are created but locked so that they are not security holes if they are inadvertently included in a production install. To unlock scott
- Connect as SYS, i.e. from the command line (DOS prompt in Windows)
sqlplus / as sysdba- Unlock the account
SQL> ALTER USER scott ACCOUNT UNLOCK;Now, you should be able to log in as SCOTT. If you want to log in as HR, OE, or any of the other demo accounts, you'd repeat the procedure.
Justin -
Have to Display Transfer orders in horizontal format in script outputlayout
Hi,
I had a problem, I have to display Transfer Orders in Horizontal format in Script Out put layout.
For this i need a logic for displaying in horizontal way..
Can you suggest anything ?
Thanks a lot .....Hi ,
Example think that each Transfer order have different values and this form is displaying all this details in single layout..
If I have different Transfer order in internal table it displaying in form as:
1) Transfer order 3) Transfer order
2) Transfer order 4) Transfer order
But i need the out put as given below..
1) Transfer order 2) Transfer order
3) Transfer order 4) Transfer order
So kindly suggest me....
thanking you.......... -
Grant permission on SCOTT/tiger schema
grant select, insert, update, delete on EM to BOMBAC
I want to add permission that user BOMBAC can see EM table from SCOTT/tiger scheme and use it. But he can not see and use it. Any idea why?
regardsyes i try with public but it seems that i do not have enought privilegies
*Cause: An attempt was made to change the current username or password
without the appropriate privilege. This error also occurs if
attempting to install a database without the necessary operating
system privileges.
When Trusted Oracle is configure in DBMS MAC, this error may occur
if the user was granted the necessary privilege at a higher label
than the current login.
*Action: Ask the database administrator to perform the operation or grant
the required privileges.
For Trusted Oracle users getting this error although granted the
the appropriate privilege at a higher label, ask the database
administrator to regrant the privilege at the appropriate label.
Maybe you are looking for
-
I have just written a little book, on my iPad, using 'Pages' I was able to download it for proofreading, however, this facility has now ceased. When I press 'send' it makes the 'rushing sound' but in fact does not download! Please will someone help,
-
Can anyone tell me if there are any plans for BT Vision to have channel 5 HD? It's so annoying having so few HD channels. Am thinking of going back to SKY
-
Only prints part of long e-mails
On long e-mails, print preview shows only data that would end up on page 1 and that is all that prints
-
How to Store resultset in .xls or .csv format
How we can store a resultset in .xls or .csv format, When we don't know the colum names,or no. of columns in the result set, or you want to generlize the code. Each time for every query execution.getting the field from the resultset and appending ','
-
Don't overwrite files on install
I was wondering if there is a way to avoid overwriting files if they already exist when doing an install. For example, if I run an installer in order to upgrade an exe, I don't want the user's custom config files overwritten back to their defaults by