Learning PL/SQL with SQL plus

I'm looking to teach myself PL/SQL with SQL Plus, it's a works pc so I can not use any other software than SQL plus.
When starting SQL plus I'm asked for a username, password and host string.
I'm taking it the host string is the db I want to connect to and obviously supply the username and password for level of access?
Also what I ideally need is a sample db on my local machine to connect to with SQL plus to learn that way.
Can anyone point me in the right direction please. Any help is greatly appreciated.

Use the net8 configuration assistant preferably as it'll get the syntax correct.
Otherwise you copy the sample one up one folder and edit that.
Connection information (SID, Server/IP, port number) you'll have to get off your DBA.
The name at the start of a tnsnames entry is the name that you want to reference the database as, so you can call it FRED if you like.
e.g.
FRED =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS =
        (PROTOCOL = TCP)
        (HOST = <server name or ip address>)
        (PORT = <port>) -- usually 1521 but can differ if more than one instance on the server
    (CONNECT_DATA =
      (SID = <database SID>) -- the name of the database on the server.
  )Once that's set up you can then log onto the database in the following way:
sqlplus <user>/<password>@fred
What happens is that the TNS Listener service (that should be running on your PC) will look up "fred" in the tnsnames.ora file and then use the information from that to make the connection to the server on the correct port and connect you to the actual database on there.
After that.... it's up to you.
:)

Similar Messages

  • Tunning PL/SQL  with sql dynamic returning cursor

    Hi
    How can I to tunning a Stored Procedure with Dynamic Cursor that return a Cursor (resultset to VB), is very slow

    1. Run your app (or better yet your PL/SQL procedure) with SQL_TRACE=TRUE and analyze trace file (TKPROF report e.g.)
    2. Tune SQL executed by PL/SQL procedure directly. Copy the SQL from the procedure, run it in SQL*Plus [with SET AUTOTRACE ON] and analyze exec plan, statistics etc.
    3. profile your procedure to figure out which part of it takes what (time, resources etc.)

  • Backspace with SQL*Plus

    Hi,
    when I use backspace on my keyboard with SQL*Plus or svrmrgl,
    the symbol ^h is comming on my screen.
    But I want delete the character before the cursor.
    Any idea ???
    Thanks
    null

    Pardon my ignorance, but what's the significance of the N'<string>' construction? That's not one I'm familar with.
    Justin

  • Downloading and installing Oracle (with sql plus) on Windows 7 Professional

    Hi,
    I got a new laptop which has Windows 7 Professional (64 bit). I intend to download Oracle 10g and would like to install bothe the database and the sql plus in this system.
    I would appreciate if somebody could provide me a link to the appropriate database (with sql plus installation capability). Also if available the installation guide.
    Thanks in advance.

    Hello,
    Windows 7 Professional (64 bit). I intend to download Oracle 10g and would like to install bothe the database and the sql plusOracle *10g* is not certified on Windows *7*, except with the latest patchset *10.2.0.5*, and its Premium Support ended on the *31st of July 2010*.
    You should download Oracle *11.2* which is certified on Windows *7 - 64 bit*.
    You'll find the Documentation and Download tabs on the link below:
    http://www.oracle.com/technetwork/database/enterprise-edition/overview/index.html
    About SQLPlus, it's delivered with Oracle Server and, in *11g*, you can still use it from a DOS box. If you intend to have a Graphical Tool, you should use Oracle SQL Developer instead:
    http://www.oracle.com/technetwork/developer-tools/sql-developer/overview/index.html
    Hope this help.
    Best regards,
    Jean-Valentin

  • SQL-Command to long to run with SQL*Plus

    Hello to everyone,
    I'm creating a dynamic SQL Script to run with SQL*Plus.
    The Script contains only INSERT Command.
    The point is that the SQL*Plus supports only SQL-Strings (Commands)
    not longer than 2500 Characters.
    I've considered to split the String in Insert- and Update-Command(s),
    but I've would like first to know if there any simpler way to run these
    Commands on SQL*Plus.
    thanx in Advance
    bm

    SQL> create table t(x varchar2(4000));
    Table created.
    SQL> insert into t values (
    '1234567890........0........0........0........0........0........0........0........0......100' ||
    '1234567890........0........0........0........0........0........0........0........0......200' ||
    '1234567890........0........0........0........0........0........0........0........0......300' ||
    '1234567890........0........0........0........0........0........0........0........0......400' ||
    '1234567890........0........0........0........0........0........0........0........0......500' ||
    '1234567890........0........0........0........0........0........0........0........0......600' ||
    '1234567890........0........0........0........0........0........0........0........0......700' ||
    '1234567890........0........0........0........0........0........0........0........0......800' ||
    '1234567890........0........0........0........0........0........0........0........0......900' ||
    '1234567890........0........0........0........0........0........0........0........0.....1000' ||
    '1234567890........0........0........0........0........0........0........0........0.....1100' ||
    '1234567890........0........0........0........0........0........0........0........0.....1200' ||
    '1234567890........0........0........0........0........0........0........0........0.....1300' ||
    '1234567890........0........0........0........0........0........0........0........0.....1400' ||
    '1234567890........0........0........0........0........0........0........0........0.....1500' ||
    '1234567890........0........0........0........0........0........0........0........0.....1600' ||
    '1234567890........0........0........0........0........0........0........0........0.....1700' ||
    '1234567890........0........0........0........0........0........0........0........0.....1800' ||
    '1234567890........0........0........0........0........0........0........0........0.....1900' ||
    '1234567890........0........0........0........0........0........0........0........0.....2000' ||
    '1234567890........0........0........0........0........0........0........0........0.....2100' ||
    '1234567890........0........0........0........0........0........0........0........0.....2200' ||
    '1234567890........0........0........0........0........0........0........0........0.....2300' ||
    '1234567890........0........0........0........0........0........0........0........0.....2400' ||
    '1234567890........0........0........0........0........0........0........0........0.....2500' ||
    '1234567890........0........0........0........0........0........0........0........0.....2600' ||
    '1234567890........0........0........0........0........0........0........0........0.....2700' ||
    '1234567890........0........0........0........0........0........0........0........0.....2800' ||
    '1234567890........0........0........0........0........0........0........0........0.....2900' ||
    '1234567890........0........0........0........0........0........0........0........0.....3000'
    1 row created.try to break your query in multiple lines in order to avoid
    SP2-0027: Input is too long (> 2499 characters) - line ignored

  • Error Handling with sql *plus from a shell script

    When I execute sql plus in a shell script with the wrong username/pass pair, the shell script hangs without terminating. What is the proper way to execute sql plus in a shell script that will catch a login failure and make sure the script doesn't hang?
    Example:
    We execute the following in our shell script:
    sqlplus ${ORACLE_INST} @./sql/ftp_ledger_put.sql
    Now if somebody comes along and alters the login then the script would hang. Is there a way to have the script exit gracefully?

    Not the most elegant solution but.......
    sqlplus &lt;&lt;EOD 2&gt;&1 &gt;some_log_file
    user/pwd
    @somescript
    exit
    EOD
    Because sqlplus allows for 3 tries at log in if user/pwd is not valid it will try to use subsequent lines. Each will fail.
    You have to look in some_log_file to determine success/failure
    Ken

  • Is it possible to use MERGE with sql*plus and if yes how?

    Hello everybody,
    I have an xls file and I have to load its data with sql*loader, but instead of "APPEND" operation stated in the control file I need MERGE operation.Here is what my control file contains:
    LOAD DATA
    INFILE 'C:\WORK\DSK_WH\LOAD_FIRST\sqlldr\data.csv'
    BADFILE 'C:\WORK\DSK_WH\LOAD_FIRST\sqlldr\p_badfile.txt'
    APPEND
    INTO TABLE D_ACCOUNT_NAMES_TMP
    FIELDS TERMINATED BY ";"
    TRAILING NULLCOLS
    (account_number , consignment, sub_consignment, consign_sub_consign, account_name_bg, account_number_2, consign_parent_2, account_name_bg_2, account_number_3, account_name_bg_3, account_number_4, account_name_bg_4, account_number_5 , ACCOUNT_NAME_BG_5 ).
    How can I use merge in this case , instead of insert ?
    Regards,
    Maria

    I'm not sure if there is any MERGE thing in SQL*Loader, but you can have a backup table which gets loaded by SQL*Loader and then use MERGE statement from backup to the original table, if your data is not huge to become a performance barrier. This is just a suggestion, may be you can try some reading of SQL*Loader here.
    http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96652/part2.htm#436160
    Cheers
    Sarma.

  • W'azup with SQL Developer barfing on SQL*Plus "set" commands

    Check out this short script and the results it generates, as pasted below.
    I can't find anything in the SQL Dev documenation re: what SQL*Plus set commands it supports and which it considers "passe." I'm particularly puzzled by the "column ... format ..." command getting ignored.
    set heading off
    set pagesize 0
    set linesize 80
    set feedback off
    prompt ...start...
    column x format a5
    select 'abcdefghij' x from dual;
    prompt ...end...
    line 1: SQLPLUS Command Skipped: set heading off
    line 2: SQLPLUS Command Skipped: set pagesize 0
    line 3: SQLPLUS Command Skipped: set linesize 80
    ...start...
    X ----------
    abcdefghij 1 rows selected
    ...end...

    For supported SQL*Plus commands: SQL Developer Help > SQL Developer Concepts and Usage > Using the SQL Worksheet > SQL*Plus Statements Supported and Not Supported in SQL Worksheet.
    The "column ... format ...." command is not supported. A workaround is to use substr in your select statement.
    See also How to set a column size in sqldeveloper?

  • If..then..else statement in SQL with 'generalized' conditions in the if sta

    it is possible to write something approaching an if..then..else statement in SQL with 'generalized' conditions in the if statement.
    Attached is the query for the payment register, in which I've written a series of decode statements, one for each possible value of the payment code. The query works OK - however, its specific and as the number of paycodes expand (and they do), the report won't pick up the new paycode until the code is changed. More importantly, the report won't be correct until someone 'discovers' that a paycode is missing, which might take months.
    If I were writing the equivalent of this series of decode statements in Focus, it would be something like this:
    DEFINE.......
    PAYMED/D12.2 = IF PAYMENT_CD LE 18
                   THEN PAYMENT_AMT
                   ELSE 0 ;
    PAYIND/D12.2 = IF PAYMENT_CD GE 19 AND PAYMENT_CD LE 49
                   THEN PAYMENT_AMT
                   ELSE 0 ;
    PAYEXP/D12.2 = IF PAYMENT_CD GE 70
                   THEN PAYMENT_AMT
                   ELSE 0 ;
    PAYREC/D12.2 = IF PAYMENT_CD GE 50 AND PAYMENT_CD LE 69
                   THEN PAYMENT_AMT
                   ELSE 0;
    END
    IN SQL/PLUS:
    SELECT ACCOUNT_NAME,
    LOCATION_1,
    CLMNT_LAST_NAME,
    CLAIM_NBR,
    DATE_OF_INJURY,
    DATE_CHECK_REGISTER,
    PAYEE_NAME_1,
    PAYMENT_CD,
    SERV_OFC,
    CPO_CHECK_NBR,
    PAYMENT_FORM,
    DECODE(PAYMENT_CD, 20, PAYMENT_AMT, 21, PAYMENT_AMT,
    22, PAYMENT_AMT, 23, PAYMENT_AMT, 25, PAYMENT_AMT,
    26, PAYMENT_AMT, 27, PAYMENT_AMT, 28, PAYMENT_AMT,
    29, PAYMENT_AMT, 30, PAYMENT_AMT, 31, PAYMENT_AMT,
    32, PAYMENT_AMT, 33, PAYMENT_AMT, 34, PAYMENT_AMT,
    35, PAYMENT_AMT, 36, PAYMENT_AMT, 37, PAYMENT_AMT,
    39, PAYMENT_AMT, 40, PAYMENT_AMT, 41, PAYMENT_AMT,
    42, PAYMENT_AMT, 43, PAYMENT_AMT, 44, PAYMENT_AMT,
    45, PAYMENT_AMT, 46, PAYMENT_AMT, 47, PAYMENT_AMT,
    48, PAYMENT_AMT, 49, PAYMENT_AMT, NULL) INDEMNITY,
    DECODE(PAYMENT_CD, 0, PAYMENT_AMT, 1, PAYMENT_AMT,
    2, PAYMENT_AMT, 3, PAYMENT_AMT, 4, PAYMENT_AMT,
    5, PAYMENT_AMT, 6, PAYMENT_AMT, 7, PAYMENT_AMT,
    8, PAYMENT_AMT, 9, PAYMENT_AMT, 10, PAYMENT_AMT,
    11, PAYMENT_AMT, 12, PAYMENT_AMT, 13, PAYMENT_AMT,
    14, PAYMENT_AMT, 15, PAYMENT_AMT, 18, PAYMENT_AMT,
    17, PAYMENT_AMT, NULL) MEDICAL,
    DECODE(PAYMENT_CD, 70, PAYMENT_AMT, 71, PAYMENT_AMT,
    72, PAYMENT_AMT, 73, PAYMENT_AMT, 74, PAYMENT_AMT,
    75, PAYMENT_AMT, 76, PAYMENT_AMT, 77, PAYMENT_AMT,
    78, PAYMENT_AMT, 79, PAYMENT_AMT, 80, PAYMENT_AMT,
    81, PAYMENT_AMT, 82, PAYMENT_AMT, 83, PAYMENT_AMT,
    84, PAYMENT_AMT, 85, PAYMENT_AMT, 86, PAYMENT_AMT,
    87, PAYMENT_AMT, 88, PAYMENT_AMT, 89, PAYMENT_AMT,
    90, PAYMENT_AMT, NULL) EXPENSES,
    DECODE(PAYMENT_CD, 50, PAYMENT_AMT, 51, PAYMENT_AMT,
    52, PAYMENT_AMT, 53, PAYMENT_AMT, 54, PAYMENT_AMT,
    55, PAYMENT_AMT, 56, PAYMENT_AMT, 57, PAYMENT_AMT,
    58, PAYMENT_AMT, NULL) RECOVERIES,
    DECODE(PAYMENT_FORM, 'N', PAYMENT_AMT, NULL) NONCASH,
    DATE_FROM_SERVICE,
    DATE_THRU_SERVICE
    FROM &INPUT_TABLES
    WHERE &SECURITYCOND
    DATE_OF_PAYMENT BETWEEN :START_DATE AND :END_DATE
    ORDER BY LOCATION_1, CPO_CHECK_NBR
    As you can see, this is both much easier to write and covers the possibility of expansion of paycodes (expansions always fit in these defined ranges).
    My question is, then, is it possible to write something like this in SQL and, if so, could you give me some sample code? (I'm one of those people who learn best from looking at the code as opposed to a set of instructions)

    Here is one way you could do it.
    Create a table that has columns like:
    Payment_code varchar2(2),
    Effective_Date Date,
    Payment_type varchar2(20),
    Expiration_Date Date)
    Payment type for example could be
    I- indemnity
    M- medical
    R- recovery
    E- expenses
    Let the table name for example be PAYMENT_CODE.
    The select query would look like
    SELECT ACCOUNT_NAME,
    LOCATION_1,
    CLMNT_LAST_NAME,
    CLAIM_NBR,
    DATE_OF_INJURY,
    DATE_CHECK_REGISTER,
    PAYEE_NAME_1,
    PAYMENT_CD,
    SERV_OFC,
    CPO_CHECK_NBR,
    PAYMENT_FORM,
    DECODE(p.payment_type,'E',PAYMENT_AMOUNT,0) expenses,
    DECODE(p.payment_type,'I',PAYMENT_AMOUNT,0) indemnity,
    DECODE(p.payment_type,'M',PAYMENT_AMOUNT,0) Medical,
    DECODE(p.payment_type,'R',PAYMENT_AMOUNT,0) recoveries,
    DECODE(PAYMENT_FORM, 'N', PAYMENT_AMT, NULL) NONCASH
    FROM &INPUT_TABLES,
    PAYMENT_CODE P
    WHERE P.PAYMENT_CODE = SOMEINPUT_TABLE.PAYMENT_CODE
    and other conditions
    The idea is to group all the payment codes into a few groups to reduce the clutter. If there is ever a change to the payment code, you could modify the table and it will be reflected in your select query.

  • Integrating J2EE application with SQL Server Reporting Services

    Hello everybody,
    I want to integrate a J2EE application with SQL Server 2005 Reporting Services. In fact, it is the first time to be involved in developing an interoperability component between .Net web service and Java application. So I have learned for some time how to pass this challenge. Moreover, I found the following virtual lab is an excellent starting point "MSDN Virtual Lab: Implementing SQL Server Reporting Services with a Java Enterprise Edition (EE) Application" [http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032315323&EventCategory=3&culture=en-US&CountryCode=US]
    After going through the lab, I tried to apply the same code in my machine but I have stuck with the following error:
    {color:#ff0000}*; nested exception is:*
    org.xml.sax.SAXParseException: Premature end of file.
    {color}{color:#333333}I use the following tools:
    - Netbeans IDE 6.5
    - Java SDK: build 1.6.0_01-b06
    - Web Server: Apache Tomcat 6.0
    - axis Jars (axis.jar, axis-ant.jar, commons-discovery-0.2.jar, commons-logging-1.0.4.jar, jaxrpc.jar, log4j-1.2.8.jar, saaj.jar, wsdl4j-1.5.1.jar)
    - Reporting Tool: SQL Server 2005 Reporting Services
    I will be so grateful if someone help me. I am waiting your response
    this is a snippet of my code :
    {color}{color:#333333}
    package net;
    {color}{color:#333333}
    //import java.io.*;
    import com.microsoft.schemas.sqlserver._2005._06._30.reporting.reportingservices.*;
    import java.io.Serializable;
    * @author Abdullah Al Fararjeh
    public class NetData implements Serializable
    static String[] data;
    public NetData(){}
    public static String[] getData(String myURL, String searchStr)
    try{
    CatalogItem[] returnedItems;
    String folderName = "/";
    returnedItems = FindReports(folderName, myURL, searchStr);
    if(returnedItems != null && returnedItems.length > 0){
    int count = returnedItems.length;
    data = new String[count];
    for(int x = 0; x < returnedItems.length; x++){
    data[x] = returnedItems[x].getPath();
    else
    data = new String[] {"No Records Found"};
    return (data);
    catch(Exception e){
    System.out.println(e.getMessage());
    String[] s = new String[1];
    s[0] = e.getMessage();
    return (s);
    private static CatalogItem[] FindReports(String folderName, String serverUrl, String searchStr)
    try
    //CatalogItem find;
    ReportingService2005Locator loc = new ReportingService2005Locator();
    //retrieve a report from the service locator
    ReportingService2005Soap port = loc.getReportingService2005Soap(new java.net.URL(serverUrl));
    //set the HTTP Basic Authentication credintials using Stub object methods
    javax.xml.rpc.Stub stub = (javax.xml.rpc.Stub) port;
    stub._setProperty(javax.xml.rpc.Stub.USERNAME_PROPERTY, "abdullahPC\\abdullah");
    stub._setProperty(javax.xml.rpc.Stub.PASSWORD_PROPERTY, "mypassword");
    //set up a search condition where the item name contains the specified search string
    SearchCondition condition = new SearchCondition();
    condition.setCondition(ConditionEnum.Contains);
    condition.setName("Name");
    if(searchStr != null)
    condition.setValue(searchStr);
    else
    condition.setValue("");
    //create an array of SearchCondition which will contain our single search condition
    SearchCondition[] conditions;
    conditions = new SearchCondition[1];
    conditions[0] = condition;
    //Call the web service with the appropriate parameters
    CatalogItem[] returnedItems;
    System.out.println("before port.findItems");
    returnedItems = port.findItems(folderName, BooleanOperatorEnum.Or, conditions);
    System.out.println("after port.findItems");
    return returnedItems;
    catch(Exception e){
    System.out.println(e.getMessage());
    return null;
    {color}
    Edited by: Abdullah on Feb 8, 2009 3:03 AM

    I also need to do this. Were you successful in getting this to work? Is it possible for you to share how you accomplished this?

  • Dilemma of an OCA (SQL, PL/SQL) with 4 years work-ex

    Dear all,
    I am an OCA(SQL, PL/SQL) and working on a enhancement/production support project (Tech: JAVA and Oracle, Func: Insurance) in my firm. I am doing quite well here and keep updating myself using oracle documentation and application functionality. But in a long term, I am confused about my career path, what should I do next? Should I upgrade myself with certification in advanced PL/SQL or should I move towards DBA activities or should I learn JAVA to be an software architect?
    Personally, I have great interest in oracle database, design and implementation, what can be a career path for a software architect?
    Please help.

    OracleDeft wrote:
    Dear all,
    I am an OCA(SQL, PL/SQL) and working on a enhancement/production support project (Tech: JAVA and Oracle, Func: Insurance) in my firm. I am doing quite well here and keep updating myself using oracle documentation and application functionality. But in a long term, I am confused about my career path, what should I do next? Should I upgrade myself with certification in advanced PL/SQL or should I move towards DBA activities or should I learn JAVA to be an software architect?
    Personally, I have great interest in oracle database, design and implementation, what can be a career path for a software architect?
    Please help.Bringing you PL/SQL up to OCP by studying for and taking 1z0-146 is probably a straightford and low impact descision.
    It may not however be in the route you wish to take your career, but it is relatively low cost and good gain.
    My impression is your not currently into Java ... learning that from the bottom may be a hard process and even having learn Java than in itself does not make one a software architect.
    Take a browse down all Oracle Certifications at [http://www.oracle.com/education/certification] ... certifications ... view all certifications ... but remember not all Oracle products / technologies have associated certifications.
    Consider SOA or BIEE or Oracle Application Express as well
    -

  • Essbase Studio - Failed to Establish Connection With SQL Database Server

    Hi all,
    I am new to Hyperion and am having trouble deploying what seems a simple cube in Essbase Studio.
    My environment is Windows 2003, EPM 11.1.1.2, SQL Server 2000.
    I have the following two issues which may be related.
    1. The EPM System Diagnostic tool says that Hyperion Foundation cannot connect to the SQL database.
    Error:
    Failed: Connection to database
    Error: java.net.UnknownHostException: <server name: <server name>
    Recommended Action:
    Every other EPM application is able to connect to the database. I have tried re-configuring Foundation Services and checking the config files and nothing looks wrong. I would appreciate advice on how to fix this.
    2 In Essbase Studio, I was able to connect to the database where the source data is, build the minischema and create dimensions and measures. But when I run the cube deployment wizard I get the error:
    Message: Failed to deploy Essbase cube
    Caused By: Failed to build Essbase cube dimension: (Time)
    Caused By: Cannot incremental build. Essbase Error(1021001): Failed to Establish Connection With SQL Database Server. See log for more information
    …ODBC Layer Error: [08001] ==> [[Microsoft][ODBC SQL Server Driver][TCP/IP Sockets]SQL Server does not exist or access denied.]
    I have checked the DSN as well as the connections set up within Studio, and they are all able to connect to the database. I am using the admin user for the Essbase server and have created a different user for the databases where the data resides and the shared services database. I tried using the same user all the way through and this didn’t help.
    Can you please advise what else I can check or change to resolve this issue.
    Also, can you work in EAS with cubes that are created in Studio? I tried looking at it and I got an error that the rule file couldn’t be accessed because it was created in Studio.
    After the above failures, I tried creating a cube in EIS, with mixed success. I have been able to load the members and data without errors. But when I try to view the data in the cube, I am seeing field names for the measures instead of the data itself.
    ...Definitely more questions than answers at this stage of my learning.
    Regards
    Michelle

    Michelle,
    I don't know if you found an answer to you question after so many months but I was hoping I could be helpful.
    The issue you are experience happens often when the dimension that you are getting an error on, in this case TIME, is built from a snowflake lineage and there is a bad foreign key reference. This dimension is most like high-up in your outline build process for Essbase Studio and this prevents the build from happening usually early on.
    Check your logs also. They are in Hyperion > Products > logs > essbase > essbasestudio.
    You can also make your logs more verbose by setting a configuration variable in the essbase studio server.properties file but that should only be used for debugging as it really saps performance.
    And, yes, you can of course edit an Essbase Studio deployed cube in EAS. However, any changes you make to the cube in EAS are subject to being wiped-out upon the next Essbase Studio deployment of that Applicaion/Database combo.
    If you want to provide more detail, screenshots, etc. I would be glad to help where I can.
    Cheers,
    Christian
    http://www.artofbi.com

  • Rows to be displayed as Columns with SQL

    I have a select statment
    SQL> SELECT T.CODE,T.DESCRIPTION from tmp t;
    CODE DESCRIPTION
    1 1-1
    1 1-2
    1 1-3
    1 1-4
    I want with SQL not SQL*PLUS nor Cursors to see the output of my SQL statment as
    1 1-1 1-2 1-3 1-4
    Please Help

    You could try something like that :
    SQL> with tbl as
      2  (select 1 code, '1-1' descr from dual union all
      3   select 1 code, '1-2' descr from dual union all
      4   select 1 code, '1-3' descr from dual union all
      5   select 1 code, '1-4' descr from dual) -- end of data sample
      6  select code, max(sys_connect_by_path(descr,' ')) keep (dense_rank last order by length(sys_connect_by_path(descr,' '))) descr
      7  from   tbl
      8  connect by code = prior code and descr > prior descr
      9  group by code
    10  /
          CODE
    DESCR
             1
    1-1 1-2 1-3 1-4Nicolas.

  • Plsql procedure with sql query data

    plsql newbie(learning sql): please excuse for asking a basic plsql question
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod on windows server 2003
    PL/SQL Release 10.2.0.1.0 - Production
    "CORE     10.2.0.1.0     Production"
    TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    CREATE OR REPLACE PROCEDURE p_check
    AS
    v1 NUMBER(20,0);
    BEGIN
    SELECT count(*) INTO v1
    FROM ad_reg;
    dbms_output.put_line(v1);
    end;
    inserts the number of rows in the table ad_reg into v1
    and displays v1 by using dbms_output
    i want my procedure to return table data
    CREATE TABLE "TEST_SH"
    "TEXT_ID" NUMBER,
    "TEXT" CLOB
    Insert into TEST_SH (TEXT_ID) values (1);
    Insert into TEST_SH (TEXT_ID) values (2);
    Insert into TEST_SH (TEXT_ID) values (3);
    Insert into TEST_SH (TEXT_ID) values (4);
    there will be a way with which i can see all the data(select * from test_sh) as the output of the plsql procedure
    1.please tel me what to google
    2.please guide me with a site or tell what is actually used and help me
    3.or post an example here
    thank you much
    Edited by: 946207 on Nov 20, 2012 2:05 PM

    946207 wrote:
    there will be a way with which i can see all the data(select * from test_sh) as the output of the plsql procedurePL/SQL is
    a) nothing at all like T-SQL
    b) two different languages, PL (Programming Logic) and SQL
    SQL is used to access data in the Oracle database. So select * from test_sh is the correct statement to access the data.
    The client can make execute this SQL statement itself. And view the data. However, this requires the client to understand the SQL language, and the database model. Which is typically not that you want. You want to abstract that from the client.
    Why would you want the client to deal with the complexities of the SQL language? Or deal with the complexities of your database model in Oracle?
    So instead of the client doing SQL, PL/SQL can do it on behalf of the client. The client uses PL/SQL as an API - in a similar fashion as the client would use any other API.
    The PL/SQL code determines the SQL statement - and returns a SQL cursor handle to the client. The client then simply uses the SQL cursor that the PL/SQL code created for it (and the client needs to close the SQL cursor when done, so as to not cause server resource leakage).
    E.g. (using PL/SQL as an API to abstract SQL and the data model)
    create or replace procedure TestProc( c out sys_refcursor ) is
    begin
      open c for select * from test_sh order by 1;
    end;The client then calls TestProc and gets a reference cursor handle. E.g. (the client call to Oracle):
    begin
      TestProc( c => :1 );
    end;The client needs to supply a host (client language) bind variable of type cursor, as value for bind variable +:1+.
    This is the correct way to deal with PL/SQL and cursors from a client GUI/language perspective. Any other method, like using PL/SQL to cache SQL data as a collection, is usually very wrong.

  • Error: connecting to db with SQL Developer

    Hi,
    I have just done a test disaster recovery (complete restore and recovery) of my database. I have successfully restored and recovered my database and managed to open the database , though with a few warnings shown below
    RMAN> alter database open resetlogs;
    database opened
    RMAN-06900: WARNING: unable to generate V$RMAN_STATUS or V$RMAN_OUTPUT row
    RMAN-06901: WARNING: disabling update of the V$RMAN_STATUS and V$RMAN_OUTPUT row
    s
    ORACLE error from target database:
    ORA-06553: PLS-801: internal error [56319]
    When I try to use sql developer to access the database. I end up getting the following error:
    ORA-06544: PL/SQL:internal error, arguments: [56319], [], [], [], [], [], [], []
    ORA-06553: PLS-801: internal error [56319]
    06544. 00000 - "PL/SQL: internal error, arguments: [%s], [%s], [%s], [%s], [%s], [%s], [%s], [%s]"
    *Cause: A pl/SQL internal error occurred.
    *Action: Report as a bug; the first argument is the internal error number.
    vendor code 6544
    This has been the first time I performed full recovery.
    I am using sqldeveloper 1.1 and running oracle 10g R2
    I was wondering if anybody has come across this problem before
    Any help would be appreciated

    Sorry, I meant that "restore database" and "recover database" commands both completed successfully without errors<br><br>
    I had a try connecting with sql *plus, which I get <br><br>
    ORA-06553:PLS-801 internal error.<br><br>
    <i>HOWEVER</i>, I still get connected, and can run queries against the tables<br><br>
    You'd get better response from the Recovery Manager forum...<br>Sorry you are right,

Maybe you are looking for

  • Generate Photo Gallery XML for Spry with Adobe Bridge

    Wanted to post a note to what I've discovered/worked out -- a way to generate a very useful photos.xml from Adobe Bridge. If you use Bridge, it's very easy to add titles, keywords, ratings -- all kinds of metadata that one might use in a photo galler

  • IPOD TOUCH not recognize by PC

    My IPOD Touch G1 is not recognized by all my PC. I do every thing i see in all the forum. When i connect on USB, my PC try to install a new device and say finally: unknown Sometimes, Itunes start and IPOD appear. If i try to Synchronize, i have, late

  • Transfer Case Animation Question Regarding if Logic.

    I am using the following code in a transfer case animation and for the life of me, I can't figure out what I'm doing wrong.  The "if (neutralSequence ==0)" part works great, but the "}else if (neutralSequence == 14){" part doesn't. I am using traces

  • Combining Two Dimensions In Planning

    I want to generate a data form whose rows look like this: Accounts1: Actuals2010 Accounts1: Forecast2011 Accounts1: Budget2012 Accounts2: Actuals2010 Accounts2: Forecast2011 Accounts2: Budget2012 etc. As those of you who have created data forms know,

  • R3load  process

    Dear All, I need to do database export and Import method.we are using win2003 and oracle 9i with ecc5 IA64. What is the process to R3load  and what caution do i have to take when export the data form PRD system. Regards,