simple sql question

What's not here?

Select "update lookup_Nationalities set NAME = 'Philippinien' where NAME =' |" NAME of lookup_nationalities.

I want to have commands like update

Update lookup_Nationalities set NAME = 'Afghanistan', where NAME = 'Afghanistan ';

Update lookup_Nationalities set NAME = 'Belgien' where NAME = 'Belgien ';

Update lookup_Nationalities set NAME = 'China' where NAME = 'China ';

....

thanx

Hello

Whenever you have a problem, please post a small example data (CREATE TABLE and only relevant columns, INSERT statements), so that people who want to help you can recreate the problem and test their ideas.

Also post the exact results you want from this data, as well as an explanation of how you get these results from these data, with specific examples.

If you ask yourself on a DML statement, such as UPDATE, then the CREATE TABLE and you post instructions INSERT must re - create the tables as they are to the DML, and the results will be the content of the or a modified tables when it's all over.

Always say what version of Oracle you are using (for example, 11.2.0.2.0).

See the FAQ forum: Re: 2. How can I ask a question on the forums?

2843667 wrote:

What's not here?

Select "update lookup_Nationalities set NAME = 'Philippinien' where NAME =' |" NAME of lookup_nationalities.

I want to have commands like update

Update lookup_Nationalities set NAME = 'Afghanistan', where NAME = 'Afghanistan ';

Update lookup_Nationalities set NAME = 'Belgien' where NAME = 'Belgien ';

Update lookup_Nationalities set NAME = 'China' where NAME = 'China ';

....

thanx

If you want to include single quotes inside a string literal, use either 2 single quotes inside literal, like this:

Select "update lookup_Nationalities set NAME =" Philippinien "where NAME =' |" NAME

of lookup_nationalities;

or use Q-rating:

Select Q '{update lookup_Nationalities set NAME = 'Philippinien' where NAME =}' | NAME

of lookup_nationalities;

Whatever it is, you don't want anything like ' | ' at the end, after the «;»

Be careful: I bet that you do not want the output to be something like

set lookup_Nationalities set NAME = 'Philippinien' where NAME = Sverige

I suspect you want single-quota around Sverige, too.

Tags: Database

Similar Questions

  • very simple SQL question

    Hello

    Why doesn't this work?
    DELETE * FROM table;
    Thank you

    Or if you just want to remove all: truncate table {table name}

    It comes to PREDICATES when you delete, not the names of columns in your delete.

    Select! = Clear

    Published by: hoek on March 26, 2009 21:18

  • How to make this simple sql run faster?

    Here is a very simple sql, but it takes too long to finish as an hour or more, and the problem is in the table. It's a huge table with 17660025 lines.
    In addition, upd_dt is indexed.
    select distinct (dstn_type) from ims_ets_prty_msge where ims_ets_prty_msge.upd_dt > sysdate - 30;
    Execution plan seems to be no problem: (is 9i, and I do not think that it would not perform better if the UNIQUE HASH is used instead of SORT UNIQUE)
    -----------------------------------------------------------------------------------------
    | Id  | Operation                    |  Name                    | Rows  | Bytes | Cost  |
    -----------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT             |                          |     6 |    78 |  1409 |
    |   1 |  SORT UNIQUE                 |                          |     6 |    78 |  1409 |
    |   2 |   TABLE ACCESS BY INDEX ROWID| IMS_ETS_PRTY_MSGE        |   856K|    10M|    10 |
    |*  3 |    INDEX RANGE SCAN          | IMS_ETS_PRTY_MSGE_INDX5  |   154K|       |     2 |
    -----------------------------------------------------------------------------------------
     
    Predicate Information (identified by operation id):
    ---------------------------------------------------
     
       3 - access("IMS_ETS_PRTY_MSGE"."UPD_DT">SYSDATE@!-30)
     
    Note: cpu costing is off
    Here is some info on the table
    NUM_ROWS BLOCKS  EMPTY_BLOCKS AVG_SPACE CHAIN_CNT AVG_ROW_LEN
    17129540      455259     622           502             455278      188
    The thing is that we must make it run faster.
    And all I can think is to create a bitmap on dstn_type (low cardinality) index and partition the table using upd_dt;

    So my question would be is anyway that we can get a better response time without having to make that kind of change?
    Or is this kind of change really help?

    Any thoughts would be appreciated!

    Thank you

    Have you thought about putting an index on (upd_dt, dstn_type)?

    With the query you posted, and this index, it should be possible to use a full scan of the index, no visit to the table at all.

    A bitmap index would not be a good idea, if it is an OLTP application / table.

  • the basic sql question

    Hi all I have a basic sql question
    Watch below two querries
    1.  select 1 from dual where 1 in (select 1 from dual union all select null from dual) 
    
    It gives output  as 1
    
    but below one 
    
    2.   select 1 from dual where 1 not in  (select 2 from dual union all select null from dual)
    
    It gives output as no data found 
    I think as operator will not compare with all the values, but not the outcome it will compare with all values... When comparing with the value null, the result is automatically null

    I'm wrong
    Please help me on this

    and why performance wise in operator is more better than no of?

    Thanks to all in advance

    Thanks for posting your explain plan command

    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 3249215828
    
    -----------------------------------------------------------------------------
    | Id  | Operation        | Name     | Rows  | Bytes | Cost (%CPU)| Time     |
    -----------------------------------------------------------------------------
    |   0 | SELECT STATEMENT |          |     2 |     6 |     4   (0)| 00:00:01 |
    |   1 |  NESTED LOOPS    |          |     2 |     6 |     4   (0)| 00:00:01 |
    |   2 |   FAST DUAL      |          |     1 |       |     2   (0)| 00:00:01 |
    |   3 |   VIEW           | VW_NSO_1 |     2 |     6 |     2   (0)| 00:00:01 |
    |   4 |    SORT UNIQUE   |          |     2 |       |     2   (0)| 00:00:01 |
    |   5 |     UNION-ALL    |          |       |       |            |          |
    |   6 |      FAST DUAL   |          |     1 |       |     2   (0)| 00:00:01 |
    |*  7 |      FILTER      |          |       |       |            |          |
    |   8 |       FAST DUAL  |          |     1 |       |     2   (0)| 00:00:01 |
    -----------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       7 - filter(NULL IS NOT NULL)
    
    02:12:54 SQL> select 1 from dual where 1 not in  (select 2 from dual union all select null from dual);
    Elapsed: 00:00:00.01
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 3291682568
    
    -----------------------------------------------------------------
    | Id  | Operation        | Name | Rows  | Cost (%CPU)| Time     |
    -----------------------------------------------------------------
    |   0 | SELECT STATEMENT |      |     1 |     4   (0)| 00:00:01 |
    |*  1 |  FILTER          |      |       |            |          |
    |   2 |   FAST DUAL      |      |     1 |     2   (0)| 00:00:01 |
    |   3 |   UNION-ALL      |      |       |            |          |
    |*  4 |    FILTER        |      |       |            |          |
    |   5 |     FAST DUAL    |      |     1 |     2   (0)| 00:00:01 |
    |   6 |    FAST DUAL     |      |     1 |     2   (0)| 00:00:01 |
    -----------------------------------------------------------------
    
  • Output is not as expected (getting wrapped) for a simple sql script

    Hello

    I try to run a simple sql script with a few queries including a semi colon output (;) when text file separated that later - I can open in excel.

    My SQL file contains in part the code - below

    SELECT
    "PORTFOLIO" | « ; » ||
    "CONTRACT # | « ; » ||
    "CONS_INV #" | « ; » ||
    "CUSTOMER #" | « ; » ||
    "CLIENT_NAME | « ; » ||
    'MESSAGE ' | « ; » ||
    "REQUEST_ID" | « ; » ||
    "BILL_TO_COUNTRY" | « ; » ||
    "BILL_TO_ADDRESS1" | « ; » ||
    "BILL_TO_ADDRESS2" | « ; » ||
    "BILL_TO_ADDRESS3" | « ; » ||
    "BILL_TO_ADDRESS4" | « ; » ||
    "BILL_TO_CITY" | « ; » ||
    "BILL_TO_POSTAL_CODE" | « ; » ||
    "BILL_TO_STATE" | « ; » ||
    "BILL_TO_PROVINCE" | « ; » ||
    "BILL_TO_COUNTY" | « ; » ||
    "SHIP_TO_COUNTRY | « ; » ||
    "SHIP_TO_ADDRESS1" | « ; » ||
    "SHIP_TO_ADDRESS2" | « ; » ||
    "SHIP_TO_ADDRESS3" | « ; » ||
    "SHIP_TO_ADDRESS4" | « ; » ||
    "SHIP_TO_CITY" | « ; » ||
    "SHIP_TO_POSTAL_CODE" | « ; » ||
    "SHIP_TO_STATE | « ; » ||
    "SHIP_TO_PROVINCE" | « ; » ||
    "SHIP_TO_COUNTY" | « ; » ||
    "INVOICE_DATE | « ; » ||
    "INVOICE_CREATION_DATE" | « ; » ||
    "PARTIALLY_DROPPED" | « ; » ||
    "AMOUNT".
    OF the double
    /
    SELECT "DOUBLE
    /
    SELECT "error Code" | « ; » ||' Error message "OF the DOUBLE
    /

    SELECT lookup_code. « ; » || Description
    OF fnd_lookup_values
    WHERE lookup_type = 'CUST_ERROR. '
    /

    The issue I'm facing is that the output of the competitive program file comes out bit so enter each line only 132 characters in a line and therefore gets pushed in the next row in excel.

    Output-

    PORTFOLIO; CONTRACT #; CONS_INV #; CUSTOMER #; CLIENT_NAME; MESSAGE; REQUEST_ID; BILL_TO_COUNTRY; BILL_TO_ADDRESS1; BILL_TO_ADDRESS2; BILL_TO_A
    DDRESS3; BILL_TO_ADDRESS4; BILL_TO_CITY; BILL_TO_POSTAL_CODE; BILL_TO_STATE; BILL_TO_PROVINCE; BILL_TO_COUNTY; SHIP_TO_COUNTRY; SHIP_TO_ADDR
    ESS1; SHIP_TO_ADDRESS2; SHIP_TO_ADDRESS3; SHIP_TO_ADDRESS4; SHIP_TO_CITY; SHIP_TO_POSTAL_CODE; SHIP_TO_STATE; SHIP_TO_PROVINCE; SHIP_TO_COUN
    TY; INVOICE_DATE; INVOICE_CREATION_DATE; PARTIALLY_DROPPED; AMOUNT


    Please advice on all of the commands that I can use in the script sql in order to expand the output page or any other workaround solutions!
    Please answer as soon as possible if you can help me!

    Thank you!

    SQL * MORE?

    SQL> set lin 1000
    SQL> spool your_file_out.csv
    SQL> your_query
    SQL> spool off
    

    Kind regards
    Malakshinov Sayan

  • Apex SQL question - weeks of the month

    I have a sql question.
    I want to create a dynamic list.

    If the user select may2009, then I want a dynamic list of show

    04/27/2009-05/03/2009
    05/04/2009-05/10/2009
    05/11/2009-05/17/2009
    05/18/2009-05/24/2009
    05/25/2009-05/31/2009

    If the user selects Jun 2009, then the list will be
    06/01/2009-06/07/2009
    06/08/2009-06/14/2009
    06/15/2009-06/21/2009
    06/22/2009-06/28/2009
    06/29/2009-07/05/2009

    Thank you.

    Using this SQL statement, you can get this list:

    SELECT w_start || ' - ' || w_end d, w_start r
      FROM (SELECT     (week_start_list + (LEVEL - 1) * 7) + 1 w_start,
                       week_start_list + (LEVEL) * 7 w_end
                  FROM (SELECT TO_CHAR (TRUNC (TO_DATE (:my_date, 'dd.mm.yyyy'),
                                               'mm'
                                              ),
                                        'IW'
                                       ) week_begin,
                               TRUNC (TO_DATE (:my_date, 'dd.mm.yyyy'),
                                      'mm'
                                     ) m_begin,
                               TO_CHAR
                                  (TRUNC (TO_DATE (:my_date, 'dd.mm.yyyy'), 'mm'),
                                   'd'
                                  ) day_month_begin,
                               TO_CHAR
                                  (TRUNC (ADD_MONTHS (TO_DATE (:my_date,
                                                               'dd.mm.yyyy'
                                                              ),
                                                      1
                                                     ),
                                          'mm'
                                         ),
                                   'IW'
                                  ) week_end,
                               TRUNC (ADD_MONTHS (TO_DATE (:my_date, 'dd.mm.yyyy'),
                                                  1
                                                 ),
                                      'mm'
                                     ) m_end,
                               TO_CHAR
                                  (TRUNC (ADD_MONTHS (TO_DATE (:my_date,
                                                               'dd.mm.yyyy'
                                                              ),
                                                      1
                                                     ),
                                          'mm'
                                         ),
                                   'd'
                                  ) day_month_end,
                                 TRUNC (TO_DATE (:my_date, 'dd.mm.yyyy'),
                                        'mm'
                                       )
                               - TO_NUMBER
                                          (TO_CHAR (TRUNC (TO_DATE (:my_date,
                                                                    'dd.mm.yyyy'
                                                                   ),
                                                           'mm'
                                                          ),
                                                    'd'
                                                   )
                                          ) week_start_list,
                                 TRUNC
                                    (ADD_MONTHS (TO_DATE (:my_date, 'dd.mm.yyyy'),
                                                 1
                                                ),
                                     'mm'
                                    )
                               + TO_NUMBER
                                    (TO_CHAR
                                        (TRUNC
                                              (ADD_MONTHS (TO_DATE (:my_date,
                                                                    'dd.mm.yyyy'
                                                                   ),
                                                           1
                                                          ),
                                               'mm'
                                              ),
                                         'd'
                                        )
                                    )
                               - 1 week_end_list
                          FROM DUAL)
            CONNECT BY LEVEL <=
                          (SELECT   TO_NUMBER
                                       (TO_CHAR
                                           (TRUNC
                                               (ADD_MONTHS (TO_DATE (:my_date,
                                                                     'dd.mm.yyyy'
                                                                    ),
                                                            1
                                                           ),
                                                'mm'
                                               ),
                                            'IW'
                                           )
                                       )
                                  - TO_NUMBER
                                          (TO_CHAR (TRUNC (TO_DATE (:my_date,
                                                                    'dd.mm.yyyy'
                                                                   ),
                                                           'mm'
                                                          ),
                                                    'IW'
                                                   )
                                          )
                             FROM DUAL))
    

    It is a question of SQL and has nothing to do with the Apex.

    Denes Kubicek
    -------------------------------------------------------------------
    http://deneskubicek.blogspot.com/
    http://www.Opal-consulting.de/training
    http://Apex.Oracle.com/pls/OTN/f?p=31517:1
    -------------------------------------------------------------------

  • Is there a way to get a 'default' DataTemplate based on a simple sql query?

    Hi all

    I wonder if there is a way to produce a default value of the DataTemplate (or at least the dataStructure of the model portion).

    I like to call a trigger beforeReport to fill in the data for the report as such, I have to use dataTemplate instead of a simple SQL query, "select * from table_name". I have more than 50 columns on the report so I was hoping that I could not manually built a dataTemplate (or at less the part of dataStructure) for each report just be able to call a trigger.

    Thanks in advance for your ideas.
    Kind regards
    Yahya

    You need not define the cases you need the xml structure to be automatically decided by BEEP.

    
         
              
              
         
         
              
                   
              
         
    
    

    This datatemplate allows you to get the following structure

    
    
    
    
    
    ..
    ..
    
    
    
    
    ..
    ..
    
    
    
    
    ..
    ..
    
    
    
    
    ..
    ..
    
    
    /LIST_ROW>
    
    
  • Indexing for a simple SQL

    Hi guys,.

    The below SQL is to do a full table scan.

    SELECT AA, STATUS, CC, DD, FF, FF, GG, INCIDENT_ID

    OF THE TEST

    WHEN STATUS = 'F'

    AND INCIDENT_ID = '15434';

    1. After you have created an index on two columns STATUS and INCIDENT_ID, he did a scan of interval.

    PLAN_TABLE_OUTPUT
    ----------------------------------------------------------------------------------------------------
    ---------------------------------------------------

    2 - access ("STATUS" = 'F' AND "INCIDENT_ID" = '15434')

    2. I have delete the index and create again but this time on a single column INCIDENT_ID. It has the same behavior as the foregoing, do a scan of interval.

    PLAN_TABLE_OUTPUT
    -------------------------------------------
    -------------------------------------------

    1 - filter ("DELETE_IND" = 'F')
    2 - access ("PAYMENT_DET_ID" = '15434')

    The only different is the predicate as above.

    Plan with the same cost, explain.

    Therefore, can I create indexes only for incident_id? instead for 2 columns? What is actually recommended?

    SELECT AA, STATUS, CC, DD, FF, FF, GG, INCIDENT_ID

    OF THE TEST

    WHEN STATUS = 'F'

    AND INCIDENT_ID = '15434';

    Thank you

    Hello

    (1) there seems to be an inconsistency in your message: you use STATUS/INCIDENT_ID in one case and DELETE_IND/PAYMENT_DET_ID in the other, it's confusing

    (2) the difference between a single column and several (concatenated) column index here is quite simple. A multi-column index will match your completely predicate, that is, lines that meet the two conditions will return the INDEX RANGE SCAN. A single-column index will only select lines according to the requirement on the indexed column. So the question is, is quite good selectivity?

    Let me give you an example: imagine that you have a table that describes the entire population of our planet, and you consider indexing columns COUNTRY_OF_ORIGIN and NATIVE_LANGUAGE. In this case, it is obvious that NATIVE_LANGUAGE does not provide any significant additional selectivity (as in most countries, there are only few languages), so a single-column index would suffice. If you consider a different pair of columns, for example COUNTRY_OF_ORIGIN and AGE, then combined selectivity is much stronger that the selectivity of each column only, so a concatenated index would be useful.

    So all down to selectivity, namely, how to combine selectivity refers to the selectivity of single column.

    Best regards

    Nikolai

  • SQL question to get a top customer of the page

    Hi all
    I'm prasanna. I have a question about SQL, to get a customer based on name of the year and the customer. I wrote the request like this. But I got an error.

    Select calendar_year, cust_first_name, max (sum (amount_sold)) in sale, the time the customers where sales.cust_id = customers.cust_id and times.time_id = sales.time_id of the calendar_year group, cust_first_name

    The error is like this:

    * Error from the 1 in the command line:
    Select calendar_year, cust_first_name, max (sum (amount_sold)) in sale, the time the customers where sales.cust_id = customers.cust_id and times.time_id = sales.time_id of the calendar_year group, cust_first_name
    Error in the command line: 1 column: 7
    Error report:
    SQL error: ORA-00937: not a function of simple-group
    00937 00000 - 'not a single-group function. "
    * Cause:
    Action:

    Thank you inadvace
    Kind regards
    Prasanna

    865016 wrote:
    Your response, I had only one top customer with year, name of the client, amount_sold. But I need for each year

    select  calendar_year,
            cust_first_name,
            total_amount_sold max_amount_sold
      from  (
             select  calendar_year,
                     cust_first_name,
                     sum(amount_sold) total_amount_sold,
                     row_number() over(partition by calendar_year order by sum(amount_sold) desc) rn
               from  sales,
                     times,
                     customers
               where sales.cust_id=customers.cust_id
                 and times.time_id=sales.time_id
               group by calendar_year,
                     cust_first_name
            )
      where rn = 1
    / 
    

    I will give you a single customer by calendar_year.

    SY.

  • Dynamic SQL question. What are these apostrophes for?

    Here is a solution provided by Boneist in the two questions relating to a so-called simple dynamic SQL thread
    declare
    v_rs date;
    
    begin
    for i in (select table_name from user_tables)
         loop
         execute immediate 'select last_analyzed from user_tables where table_name = ''' || i.table_name||''''  into v_rs;
         dbms_output.put_line(i.table_name ||'----'||v_rs);
    end loop;
    end;
    When a tablename is extracted, it should be in single quotes as "DEPT". My question is about the quotes surrounding i.table_name (three quotes on the left) and 4 quotes on the right of the concatenation
    ''' || i.table_name||''''
    First quote on the left is the final quote from SELECT (' select last_analyzed)

    Second quote from left to right - I think this is the quote from beginning to the name of the table ("DEPT)

    Quote from third starting on the left -?



    I have not understant what 4 quotes on the right of the concatenation of c. I know one of them is the quotation from the end (right) for the name of the table (like DEPT')

    JOE_humble wrote:
    When a tablename is extracted, it should be in single quotes as "DEPT". My question is about the quotes surrounding i.table_name (three quotes on the left) and 4 quotes on the right of the concatenation

    Actually 4 quotes on the left quotation marks and 4 right...

    execute immediate 'select last_analyzed from user_tables where table_name = ''' || i.table_name||''''  into v_rs;
                      ^                                                         ^^^                  ^^^^
                      |                                                         |||                  ||||
                       \________________________________________________________///                  \||/
                                                  |                                                   \|
                                                4 quotes                                            4 quotes
    

    Maybe better if you look at it like this...

    Suppose we use a character # to indicate the beginning and the end of our strings...

    execute immediate #select last_analyzed from user_tables where table_name = ''# || i.table_name||#''#  into v_rs;
    

    Now, you can see that we have two strings concatenated with the variable string representing the table name concatenated together.

    Within each of these channels, we have two single quotes. When the parser crosses the two single quotes like this, in the string, which converts a quotation mark in the resulting string, rather than taking this means the end of the string itself.

  • If exposed simple of questions?

    Alright fellow programmers.  Once more what I meet a problem I have EVER had with other JAVA programs before.  IAM trying to figure out how to write a simple if statement and I have questions.  I did Google search and have found something to help.  So, if you could please tell me what may be the issue?  The error message is "error {invalid AssignmentOperator. syntax".   Thanks in advance!

    Double BinRadius = (Integer.parseInt (txtRadiusFeet.getText ()) * 12) + Integer.parseInt (txtRadiusInches.getText ());

    FieldChangeListener CalcListener = new FieldChangeListener() {}
    ' Public Sub fieldChanged (field field, int context) {}
    Double BinRadius = (Integer.parseInt (txtRadiusFeet.getText ()) * 12) + Integer.parseInt (txtRadiusInches.getText ());

    {If(BinRadius==0)}
    Dialog.Alert ("Hello");
    }
    };

    Capital I yew?

  • SQL question on natural joins

    I am a newbie to SQL and I studied the book of Fundamentals SQL Server Oracle OCA 12 c, but a section on natural joins to confuse me.

    Basically, the author says:

    SELECT r.region_name, d.department_name, l.city, c.country_name

    DEPARTMENTS d

    NATURAL JOIN places l, c countries, regions r;

    The natural join between DEPARTMENTS and LOCATIONS creates a provisional result, consisting of 27 lines since they are implicitly attached on the column of location_id. This set is then Cartesian-joined to the table of the COUNTRY as a join condition is not implicitly or explicitly specified. 27 interim lines are attached to 25 lines in the COUNTRY table, which gives a new temp results set with 675 (27 × 25) rows and three columns: DEPARTMENT_NAME, CITY and COUNTRY_NAME. This set is then attached to the REGION table. Once more, a Cartesian join occurs because column REGION_ID is absent from any join condition. The final result set contains rows and four columns (675 × 4) 2700.

    I can understand because you evaluate joins from the left. But then he wrote:

    The JOIN... USE and JOIN... ON the syntaxes are better suited to join multiple tables. The following query joins four tables using the natural join syntax:

    SELECT country_id region_id, c.country_name, l.city, d.department_name

    DEPARTMENTS d

    NATURAL JOIN places l

    NATURAL JOIN country c

    NATURAL JOIN region r;

    This query generates correctly 27 lines in the final results set since the required join columns are listed in the SELECT clause. The following query illustrates how the JOIN... CLAUSE is used to extract the same 27 lines. A join condition can reference columns only in its scope. In the following example, the join of DEPARTMENTS slots can not reference columns in the COUNTRIES or REGIONS of tables, but the join between the COUNTRIES and REGIONS may refer to any column of four tables involved in the query.

    This second method of the part of the natural writing joined confuses me. I don't understand the logic behind the 2nd series of States of Natural Join. For me, it seems that the first series and the 2nd set look alike, but they are apparently not.

    Can someone tell me the differences?

    Thank you!!

    Hello

    The more important thing to learn more about NATURAL JOIN is: never use it.  If you add new columns, joins can get different results.  I've never heard of someone uisng NATURAL JOIN apart from a manual or a question like yours.

    There are a lot of things in Oracle that take the time to learn and are useful.  All the time you spend learning things is better spent on them.

  • SQL * PLUS connects with SQL &gt; question

    People,

    I'm confused on the command. / sqlplus with Oracle database.

    According to my understanding,. / sqlplus connected with SQL > using option 3: sysdba, sysoper, sysasm.

    I connect with SQL > to run the rel853.sql script to create a table PSOPRDEFN but a field "OPERPSWDSALT" did not appear in the table PSOPRDEFN although it is in the Create Table statement.

    I connect with SQL * in the directory/home/user/OracleDB_Home/bin as below:


    $ export SYSTEM_PASS = AccessId/mypass

    $ export ORACLE_HOME = / home/user/OracleDB_Home

    $ export ORACLE_SID = HRCS90

    $. / lsnrctl start LISTENER

    $. / AccessId/mypass sqlplus as sysdba

    SQL > startup

    SQL > @/opt/PT8.53/scripts/rel853.sql

    SQL > select OPERPSWDSALT in the AccessId.PSOPRDEFN;

    It returns: "OPERPSWDSALT": invalid identifier.


    I checked the table PSOPRDEFN that the OPERPSWDSALT field did not appear in the table PSOPRDEFN.

    I tried the sysoper option as below:

    $. / sqlplus AccessId/mypass as sysoper

    SQL > startup

    SQL > @/opt/PT8.53/scripts/rel853.sql

    SQL > select OPERPSWDSALT in the AccessId.PSOPRDEFN;

    It returns: "OPERPSWDSALT": invalid identifier.

    The sysoper error is the same thing with sysdba error.

    I tried the sysasm option as below:

    $. / sqlplus AccessId/mypass as sysasm

    He returned: connection refused.


    Someone told me this connection as SYS causes this error. If not a sysdba, sysoper, or sysasm, use the command. / sqlplus AccessId/mypass cannot connect with SQL >.


    My question is:


    First of all, why is what OPERPSWDSALT did not appear in the PSOPRDEFN table while it is in the CREATE TABLE statement?


    Seocond, if not use SYS which is one of the 3 options, how to run the command. / sqlplus AccessId/mypass to connect with SQL > so that CREATE TABLE PSOPRDEFN correctly?

    Thank you.

    user8860348 wrote:

    People,

    Hello. Thanks much for the reply. I just do the commands below:

    $ export SYSTEM_PASS = AccessId/mypass

    $ export ORACLE_HOME = / home/user/OracleDB_Home

    $ export ORACLE_SID = HRCS90

    $. / lsnrctl start LISTENER

    $. / AccessId/mypass sqlplus as sysdba

    SQL > show user;

    Its release: the USER is "SYS".

    SQL > connect AccessId/mypass

    Its output:

    Error: ORA - 01034:ORACLE not available

    ORA-27101: shared memory realm does not exist

    64 - Linux_x86 error: no such file or directory.

    As we see above, unable to connect to the Oracle database AccessId.

    My question is:

    What to do on AccessId, so that it can connect to the Oracle database?

    Thank you.

    so much for the use that you refuse to actually use COPY it PASTE & so that we can see the whole session.

    In the past, you did

    > SQL > startup

    Maybe the database is out of order & must be started.

    do exactly as below (line by line)

    ID

    sqlplus

    / as sysdba

    startup

    connect AccessId/mypass

    COPY the results from above then PASTE all back here

  • Transformation slow simple SQL extraction

    Hello!

    I have a query:

    SELECT A.PID, A.ID, B.SID, (SELECT COUNT (*)

    Of

    B TREE_VIEW WHERE B.PID = A.ID) TREE_VIEW WHERE A.PID = BRANCH_COUNT

    V ('P30_BRANCH_ID') ORDER BY ID

    Table CN_SECTION has 131 000 lines, TREE_VIEW - view, which limit only the number of columns in the table.

    External system query runs in 5 seconds, but on DB (from TOAD), it runs from 0,5 sec.

    TKPROOF:

    SQL ID: 7m1ykt8rc626r

    Plan of Hash: 1808150050

    SELECT A.PID, A.ID, a. theNAME, (SELECT COUNT(*)

    Of

    TREE_VIEW B WHERE B.PID = A.ID) BRANCH_COUNT OF TREE_VIEW = an A.PID WHERE

    V ('P30_BRANCH_ID') ORDER BY ID

    call number of cpu elapsed disc question current lines  

    ------- ------ -------- ---------- ---------- ---------- ---------- ----------

    Parse  1   0.00   0.00   0   0   0   0

    Run 1 0.00 0.00 0 0 0 0                    

    Go get 1 4.87 5.50 0 16330 0 22                    

    ------- ------ -------- ---------- ---------- ---------- ---------- ----------

    total 3   4.87   5.50   0   16330   0   22

    Lack in bookstores during parsing cache: 0

    Optimizer mode: ALL_ROWS

    The analysis of the user id: 68 (recursive depth: 2)

    Operation of line Source lines

    ------- ---------------------------------------------------

    22 SORT GLOBAL (cr =15620 pr =0 pw =0 time=0 us)

    0 TABLE ACCESS FULL CN_SECTION (cr =15620 pr =0 pw =0 time=0 us cost =206 size=120 card =24)

    22 SORT ORDER BY (cr =16330 pr =0 pw =0 time=84 we cost =221 size=336 card =24)

    22 TABLE ACCESS FULL CN_SECTION (cr =710 pr =0 pw =0 time=2457 we cost =220 size=336 card =24)

    I think that the problem is. Why could that be? What can I do something to fix?

    Hi Plugif,

    You use a function to get the value of P30_BRANCH_ID.  Have you tried to use a variable to link instead?

    In the case of Apex, use: P30_BRANCH_ID

    If outside Apex, set a variable to this value or pass it as a parameter and use this variable in your query.

    --

    Patrick

  • Apex 4.2: really simple SQL date of issue

    Hello

    Anyone can get this SQL query with the correct date for Apex syntax?

    Select * from table
    where datecolumn > ' 2010-03-31'

    I tried with #2010-03-31 #; I tried the dd-mm-yyyy; I tried the backslashes; I tried to use a date() function; and I tried cast() and I'm stumped.

    As far as I remember, I put the global date format in dd-mm-yyyy.

    The column that I need to analyze will finally be a timestamp with time zone column (for a plugin works).

    However at this point, I can't do a simple working either date column, so it's just a problem of syntax newbie.

    Help appreciated!

    Thank you
    Emma

    Hi Emma,
    because you use a literal string, you must specify the format;

    select * from table
    where datecolumn >to_date( '2010-03-31', 'YYYY-MM-DD')
    

    Kofi

Maybe you are looking for

  • Can not find the drivers for Pavilion g6 - 2379sr

    Hi all! I have a problem: I want to download drivers for Pavilion g6 - 2379 sr with Windows 7, but not found on hp.com, there was only for Windows 8. How can I find them? Thanks for the help!

  • With the help of HP Mini, United States

    I'm in Australia and I have a HP Mini and the charger has a voltage from 100 to 240 volts.  Australia uses 240 volts is what it means that I can use in the United States with a record of adaptation?  Or will it get another charger to the United State

  • CUCM and IM &amp; P 10.5.2 disaster recovery

    Come see if I any who can sanity check it. I noticed the other day on my IM & P servers that my last successful backup was 132 days ago. Now on my CUCM I do daily backups during the week, UCM, CDR_CAR, and IMP_AND_PRESENCE backup and I can see all 3

  • Logon Windows Live Family Safety - access denied - error Code 80070005

    Hello I can't connect to Windows Live family safety. I had it installed previously and it worked but he kept asking to open a session. When I tried to connect, I get the error. I uninstalled it and re-installed, but still the same. After installation

  • Re-installing photoshop

    I recently got a new hard drive on my iMac. I need to uninstall and then reinstall photoshop and indesign. I bought others as a result. How do I re - install?