How to use the variable in the coil

How can I draw a sequence number of the database and use it in a sqlplus spool file name...
This forum works as: sqlplus user/pass@sid@c:\file.sql

sample file:

BEGIN
declare

V_E_NUMBER varchar2 (7);

Start

Select "E" | LPAD (RWP. E_NUMBER_seq. NEXTVAL, 6, '0') IN THE DOUBLE V_E_NUMBER;

end;
end;

Select "E" | LPAD (RWP. E_NUMBER_seq. CURRVAL, 6, '0') IN THE DOUBLE V_E_NUMBER;
trigger the echo
SET THE POSITION
SET LINESIZE 430
set verify off
SET PAGESIZE 0
SET TRIMSPOOL ON
SET OFF calendar
SET termout ON
SET feedback OFF
coil d:\securedASP\CORE. BU34500.AR.'|: V_E_NUMBER |'. RECEIVD
Select * from table;
spool off

Hello

Use a substitution for that variable:

COLUMN     v_e_number     NEW_VALUE v_e

SELECT   'E' || lpad ( RWP.E_NUMBER_seq.NEXTVAL
                    , 6
               , '0'
               )          AS V_E_NUMBER
FROM    DUAL;

SPOOL  d:\securedASP\CORE.BU34500.AR.&v_e..RECEIVD 

Note that this does not at all use PL/SQL.

The variable can be used without quoting or concatenation.
Which can lead to situations where it is ambiguous as to which is part of the name of the variable (the variable is named ve in this example), and what is literal text that happens to come right after him. To resolve these issues, use a point to mark the end of the variable name.
In your case, you want a literal period just after the variable name, use two: one marks the end of the name, and the other is taken literally.

Get the SQL * most orders
COLUMN,
The VALUE of CONCAT, and
SET
For more details.

Tags: Database

Similar Questions

  • How to use the global variable in the table target?

    Hello

    I am trying to load several files into a single interface. the data is loaded successfully. 92. the files are there. for this I used variables and package.

    My requrement is 92 files of data loaded into the target table. I want to know what data from file.

    to this I added a column (filename) to the existing target table.

    If I used joints (not same condition), its totally wrong. all file names are coming.

    Please see the following screenshots.

    err27.jpg

    exit; target table.

    err26.jpg

    in fact in the target table. first 10 lines are coming from file.i.e first _ACCOUNT_LIMIT_511.TXT. but all the files names are coming.

    I'm confuse. After the first data file inserted then insert second data file. in that all file names are coming. Please help me.

    I thought that the global variable is preferable to identify the data came from which file.

    to do this, the global variable is used in the target table. I don't always have my exit.

    Please help me.

    Thanks in advance.

    err25.jpg

    Hello

    You can use the same way, how you use the project variable, just you have to do a thin is #GLOBAL.variable_name for example: #GLOBAL. SMART_AL_FILE_NAME_S

    Note: Make sure you that while you use one variable overall in interface, indicator should be staged as you chose above the screen

    hope this helps you

    Kind regards

    Phanikanth

  • using the function - how to use the values of the input variables on the table select statement names

    Hello community, I have a problem when creating a function. The purpose of this function is to check the table of weather gave yesterday or not. We must check this on different tables on different sachems. We are creating a function with input variables.

    CREATE OR REPLACE FUNCTION IN_SCHEMA.IS_YDAYDATA_TO_TABLE

    (

    in_schema IN VARCHAR2,

    in_tablename IN VARCHAR2,

    in_datefield IN VARCHAR2,

    )

    RETURNS INTEGER

    AS

    -Declaring variables

    v_is_true INTEGER.

    BEGIN

    SELECT

    CASE

    WHEN MAX (in_datefield) = TRUNC(SYSDATE-1)

    THEN 1

    ON THE OTHER

    0

    END

    IN

    v_is_true

    Of

    in_schema.in_tablename

    ;

    RETURN v_is_true;

    END;

    /

    When creating, I got error: [error] ORA-00942 (44:19): PL/SQL: ORA-00942: table or view does not exist

    How to use the values of the input variables on the table select statement names?

    Hello

    Here's a way you can use dynamic SQL statements for this task:

    CREATE OR REPLACE FUNCTION IS_YDAYDATA_TO_TABLE

    (

    in_schema IN VARCHAR2,

    in_tablename IN VARCHAR2,

    in_datefield IN VARCHAR2,

    in_first_date DATE DEFAULT SYSDATE - 1,.

    in_last_date DATE by DEFAULT NULL

    )

    RETURNS INTEGER

    AS

    -IS_YDAYDATA_TO_TABLE returns 1 if in_schema.in_tablename.in_datefield

    -contains all the dates in the in_first_date of the range through included in_last_date

    - and it returns 0 if there is no such lines.

    -If in_last_date is omitted, the search only the data on in_first_date.

    -If in_first_date is omitted, it defaults to yesterday.

    -Time parts of the in_first_date and in_last_date are ignored.

    -Declaring variables

    sql_txt VARCHAR2 (1000);

    v_is_true INTEGER.

    BEGIN

    sql_txt: = 'SELECT COUNT (*).

    || 'FROM ' | in_schema | '.' || in_tablename

    || 'WHERE ' | in_datefield | ' > =: d1'

    || «AND» | in_datefield | '< >

    || 'AND ROWNUM = 1';

    dbms_output.put_line (sql_txt |) '= sql_txt in IS_YDAYDATA_TO_TABLE");  -For debugging

    Sql_txt EXECUTE IMMEDIATE

    IN v_is_true

    With the HELP of TRUNC (in_first_date) - d1

    TRUNC (NVL (in_last_date

    in_first_date

    )

    ) + 1                -- d2

    ;

    RETURN v_is_true;

    END is_ydaydata_to_table;

    /

    DISPLAY ERRORS

    If you must use dynamic SQL statements, put all the SQL statement in a single string variable, such as sql_txt in the example above.  In this way, you can easily see exactly what will be executed.  Comment out the call to dbms_output under test is completed.

    Try to write functions that will address not only the question that you have now, but similar questions that you may have in the future.  For example, now that interest you only to the verification of the data of yesterday, but later, you might want to check another day or range of days.  The above function combines the convenience of a function simple (looks like yesterday data if you don't tell him otherwise) with the power of a more complex function (you can use the same function to check any day or range of days).

  • How to use the variable in the path of the source of an image in flex

    Hello
    I just want to know that how to use the variable in the path of the source of an image in flex

    Hello
    I just want to know that how to use the variable in the path of the source of an image in flex

  • SQL how to use a variable and use the result as a reference for the name of the table

    Hi all

    I have new in the declaration of Oracle, sorry in advance if something is easy for you all. BTW, I have this scenario:

    I have a table OL structured in this way:

    Date - it contains dates, for example 11/01/2015

    TableName - it contains strings, for example, OL1, OL2, OL3 and so on...

    Then I have a different table, the name of these tables are of the same name in the table of the OL, so I have table table, OL1, OL2, OL3 table and so on. The structure of these tables is the same. And Yes.

    table OL1

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

    ID LAST NAME FIRST NAME PHONE

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

    1 JOHN DOE 12345679

    2 PAUL 111111122 TIBBS

    table OL2

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

    ID LAST NAME FIRST NAME PHONE

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

    1 ANNA KRAIG (NULL)

    NATHAN FRESHMANN 111111133 2

    If the scenario is clear, I would like to retrieve the value (null), research in all the OL * tables by using the value of the OL table (tablename) max.

    If I'm going to do these simple steps, I got the result:

    Select max (TableName) OL

    the result will be OL2

    # I know not how to use the option set to avoid changing the table name in the sql statement all the time.

    set mytable = 'OL2.

    Select Name, family name

    of & mytable

    When the phone is null

    Any idea?

    Thank you very much in advance.

    Hello

    run immediately "select dt.log_id, obj.presentation_name, dl.begin_time

    bulk collect into v_result_set

    of ' | v_ol |' dt join internal ol_object obj on

    DT.object_type_id = obj.object_type_id

    inner join ol_chunk_log dl on

    DT.log_id = DL.log_id

    where dt.data_value is null';

    dbms_output.put_line (v_ol);

    end;

    Correct the code such as:

    run immediately "select dt.log_id, obj.presentation_name, dl.begin_time

    of ' | v_ol |' dt join internal ol_object obj on

    DT.object_type_id = obj.object_type_id

    inner join ol_chunk_log dl on

    DT.log_id = DL.log_id

    where dt.data_value is null' bulk collect into v_result_set;


    for i in v_result_set.first ... v_result_set. Last

    loop

    dbms_output.put_line ('LOG ID: ' | ) ( v_result_set.log_id (i)) ;

    dbms_output.put_line (' NAME CLOSELY: ' |) v_result_set.presentation_name (i));

    dbms_output.put_line (' START TIME: ' |) ( v_result_set.begin_time (i)) ;

    end loop;

    end;

    Kind regards.

  • How to use the functions of SetValue executeScript activity.

    Hello

    Could someone let me know how to use the function activity setValue (serialize concate, count etc) in activity executeScript. What all liberaries I need to import to executeScript. I want to perform the same task in executeScript performed in the setValue activity.

    Concerning

    Sunil Gupta

    Forgive me if I seem obtuse, but why would you use XPath functions (is that serialize, concat, and count) when there are perfectly good Java alternatives that will be much easier to use.  Java is, after all, the language used in the executeScript.  Serialize is just toString(), CONCATENATE is just + or. concat() (I assume that you are running on Java 6 web application server).  The count function is just the length() or size() methods or to the tables, the length property.  If you really need to reorganize in a variable of the XML data using a XSL stylesheet - you have access to all the functions in XPath 1.0 and XPath 1.0 power and you do not need to tinker with the headache of trying to debug Java in an environment (Workbench), which does not give you the tools that you would normally , as a contextual Editor.

  • With no headphone jack, how to use the iPhone in my car 7

    Okay, so here's the challenge.  I have a power source and a headphone and not Bluetooth.  It works perfectly with iPhones before 7.  But with 7, it isn't possible to use the same configuration I had for years.  I own my car, and I have no interest in buying a new car just to support a new phone.  And since this will be a problem for the years to come if I stay with Apple, I would like to know what are the solutions are available.

    So, how to use the new iPhone 7 while remaining responsible and using my car speakers?  Dongles Bluetooth that I need to reload, it's probably not.

    Thus, looking for ideas that might have people.  I can't be the only one with this concern.

    It's almost a certainty that a third party adapter will appear quickly. The new Macbook has a single port usb - c and people asked the same question, 'how to load and use USB at the same time." There are today dozens of solutions for the Macbook, and then it will be with the iPhone 7. An adapter with a 3.5 mm jack and a port of loading Lightening would be my guess. Kickstarter entrepreneurs are probably already working on it.

  • How to use the capture and the print button

    I tried to figure out how to use the capture and the "print" button, or add or what you call. I press it and the whole page of a different color changes, so I try to cut the section I want but I don't know how to send it to the printer. Can someone help me with this. I'm not at savvy with tech stuff, but when I find a recipe or something and it doesn't have an option to print a certain area, I can't understand how to use it?

    Thank you

    Andi Starbuck

    That happens to me is, I click and drag to make a rectangle of yellow selection, and as soon as I raise my finger on the mouse button, the part I've selected is captured as an image, a new tab opens and preview before printing, the image display. I can use the installation of the Page or simply print. But if I close the preview, this temporary image vanishes and I'm back on the page where I started. You see something different?

  • How to use the activity monitor to remove MegaBAckup on my mAc Book PRO?

    How to use the activity monitor to remove MegaBAckup on my mAc Book PRO?

    Download and run MalwareBytes. Malwarebytes was developed by one of our colleagues here to ASC. He received rave reviews and is on the more proven anti-malware for Mac software.

  • How to use the utility disk first aid for hard drive internal el captian

    How to use the utility disk first aid for hard drive internal el captian

    Select the drive and click first aid.

    If something is not repairable because this is the system drive, then you need to start using the recovery partition and run disk utility it.

  • How to use the Print Screen function?

    I've seen various descriptions of how to use the print screen function.

    It would be nice to actually tell one that works.  None have worked for me.

    [Fn] and Prt SCr does not work.

    CTRL and Prt SCr does not work.

    CTRL, Alt, and Prt SCr does not work.

    [Fn], Ctrl and Prt SCr does not work.

    If anyone knows the correct method to activate the screen capture function which would be a good thing.

    From the looks of things, HP has a big problem with this function.

    Here's a microsoft articleon the use of the screenshot function.

    This should answer your questions.

    Thanks for taking a peek.

  • How to use the acronym

    How to use the acronym instead of this?

    Please explain

  • How to use the adapter from the wall with my Mac Pro laptop?

    How to use the adapter from the wall with my Mac Pro laptop?

    The AC wall connector is not compatible with the outlet on the MBP?  As the MBP charger will work from 100v to 240v, a transformer is necessary.  You need a converter that connects to the power outlet home and is compatible with your MBP.  You can buy the Apple travel kit:

    http://www.Apple.com/shop/product/MD837AM/A/Apple-world-travel-adapter-Kit

    Or you can use a single specific converter for the geographical area:

    http://www.Amazon.com/orei-grounded-universal-adapter-Singapore/DP/B004SCSV2U/re f = sr_1_4? ie = UTF8 & qid = 1460735377 & sr = 8-4 & keywords = us + in + uk + power + adapter

    (it is a UK USA example)

    Or you can get the converter that adapts the charger directly:

    http://www.Amazon.com/HIOTECH%C2%AE-extension-charger-connecting-specification/d p/B00MA48JZW/ref = sr_1_3? ie = UTF8 & qid = 1460735486 & sr = 8-3 & keywords = us + in + uk + power + ad aptor + apple + charger + cord

    (again, this is for a UK plug.)

    Ciao.

  • SOLUTION - How to use the remote on the Satellite X 200 with Win7 64 bit

    Here is the description how to use the remote control on the Satellite X 200-2 b with Windows 7 64 bit.

    Thanks for the link.

    It will be fine if some owner of Satellite X 200 can confirm.

  • How to use the software keyboard Toshiba 50L9450VE TV?

    I just bought a LED TV model 50L9450VE. When installing, I need to enter the password for the wifi network. The remote doesn't have a keyboard of the letter, and the TV shows a soft keyboard to enter the password. How to use the software keyboard? I can't figure out how to get the cursor in it; the manual does not say, and I can't find the information online. Thank you.

    Hershel

    Suppose you are from Israel? Although this model is not made for the EU market, but probably for the Asian market, it looks like the European L93 series.
    You will find how to operate the software keyboard (page 52): http://www.toshiba-om.net/pdf/manual...h-Specific.pdf

  • How to use the recovery CD?

    Hello

    Ive lost the instructions to tell me how to use the recovery CD. I forgot, I need to press to access the disks when I reboot!

    Can anyone help please?
    St. Clare

    Hi clear, before using the recovery CD make you that all important data has been saved to the floppy or USB key because the procedure will erase the entire hard drive. The method for booting from a cΘdΘrom may vary according to the model number of your laptop, but it's something like hold the 'B' button for the Toshiba Startup logo. If this fails you can try to change the boot sequence or use the Toshiba from Windows or the BIOS configuration tool (ESC then F1 when prompted from a cold start) make CD-ROM the first device startup in the list.

    Richard S.

Maybe you are looking for