Insert command in Sql

Dear Team ,
I need to insert a values into an table starts with 1 and ends with 1000 .
Insert the values manually will be tough one .
May I want to insert the values Manually ?
or Any other insert command to do this above task .
Kindly help me to solve this Issues .
Regards ,
Augustine

Augustine Vinish wrote:
My table Structure
SQL> desc office;
Name Null? Type
NAME VARCHAR2(20)
AGE NUMBER
DEPT VARCHAR2(19)
EMPID                                             VARCHAR2(20)
SALARY NUMBER
The table contains already values ,I altered this table for adding one more column (EMPID).
Now I am a in need to insert values for the column EMPIDThen just do this
update office set empid = rownumor create a sequence and use it
create sequence seqEmpid
update office set empid = seqEmpid.nextval
/

Similar Messages

  • How to insert huge XML in CLOB using insert command in sql*plus....

    How to upload huge XML into a CLOB column of a normal table using a script?
    A simple insert statement does not seem to work.
    Thanks & regards.

    In SQL *Plus i'm trying to insert directly into the table.
    My insert statement is like below :
    Insert into ui_templates
    (TEMPLATE_ID, TEMPLATE_NAME, CUSTOMER_ID, DESCRIPTION, XML_CONTENT)
    Values
    (1, 'Default', 1, 'Main Default Template', '<?xml version="1.0" encoding="utf-8"?><xoraLayout:Layout name="MyLayout" version="1.0" ................<3357> chars long');
    COMMIT;
    Message was edited by:
    DKar

  • IDOC to JDBC scenario: Does INSERT command expect a result value?

    Hello,
    we have an IDoc-to-JDBC-scenario configured on our XI 3.0, which uses the INSERT command to put a dataset coming from R/3 into a SQL database. This works fine.
    Now a trigger has been activated on the database, which sets a flag to each dataset after inserting.
    Because of this a system error occurs in the Adapter Engine and I found in the AuditLog (logSQLStatement=true), that the INSERT command is processed correcty, but in the next step an error is shown up: 'SQLServerException. A result set was generated for update.'
    Could it be, that the trigger returns a result value, which can't be handled on the XI ?
    If yes, how can I solve this issue? I have read something about the different methods execute(), executeUpdate() and executeQuery(), but I don't know how and where this has to be configured...
    Thanks in advance,
    Juergen

    Hi Upendra,
    I got some more information from the database adminstrator:
    He used the following command 'exec xp_cmdshell @ExportCmd , no_output'
    whereas @ExportCmd contains the command.
    With the no_output option, the xp_cmdshell does not return a recordset.
    I hope this will be helpful to you.
    Grtz,
    Juergen

  • Using textboxes in insert command

    Sir,
    I had a doubt about insert command while I was trying to give the content of the swing text boxes as the arguments to the insert command.Is it possible?.How can i give values to the fields of a table through GUI components.

    Hi,
    I meant using text boxes in insert statement.because all time we should not give literals.we should have got inputs from swing panel from which we have to
    insert data into tables.So I asked how can i give variables or input GUI Components as arguments of insert statement. Also I gave the code below
    //CRM Sections Campaign
    //package marketing;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.sql.*;
    public class CRM_Marketing_1B extends JFrame implements ActionListener
    JOptionPane joptMessage;
    JButton jbtnSave;
    JButton jbtnClear;
    JButton jbtnExit=new JButton("Exit");
    public CRM_Marketing_1B(String title)
    Container conMarketingPane=getContentPane();
    conMarketingPane.setLayout(new FlowLayout());
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JLabel lblCustomer_Id=new JLabel("Customer ID");
    JLabel lblCustomer_Name=new JLabel("Customer Name");
    JLabel lblCompany_Name=new JLabel("Company Name");
    JLabel lblDesignation=new JLabel("Designation");
    JLabel lblAddress1=new JLabel("Address1");
    JLabel lblAddress2=new JLabel("Address2");
    JLabel lblQuantity=new JLabel("Quantity");
    JLabel lblUnit_Price=new JLabel("Unit Price");
    JLabel lblInterest_Level=new JLabel("Interest Level");
    JLabel lblContact_No=new JLabel("Contact No");
    JLabel lblMobile_No=new JLabel("Mobile No");
    JLabel lblEmail=new JLabel("Email Address");
    JLabel lblEmployee_Id=new JLabel("Employee ID");
    JLabel lblCampaign_Date=new JLabel("Campaign Date");
    JLabel lblNext_Appointment=new JLabel("Next Appointment");
    JLabel lblCampaign_Id=new JLabel("Campaign ID");
    JLabel lblTeam_Id=new JLabel("Team ID");
    JLabel lblOrder_No=new JLabel("Order No");
    JLabel lblResult=new JLabel("Result");
    JTextField txfCustomer_Id=new JTextField(30);
    JTextField txfCustomer_Name=new JTextField(30);
    JTextField txfCompany_Name=new JTextField(30);
    JTextField txfDesignation=new JTextField(30);
    JTextField txfAddress1=new JTextField(30);
    JTextField txfAddress2=new JTextField(30);
    JTextField txfQuantity=new JTextField(30);
    JTextField txfUnit_Price=new JTextField(30);
    JTextField txfInterest_Level=new JTextField(30);
    JTextField txfContact_No=new JTextField(30);
    JTextField txfMobile_No=new JTextField(30);
    JTextField txfEmail=new JTextField(30);
    JTextField txfEmployee_Id=new JTextField(30);
    JTextField txfCampaign_Date=new JTextField(30);
    JTextField txfNext_Appointment=new JTextField(30);
    JTextField txfCampaign_Id=new JTextField(30);
    JTextField txfTeam_Id=new JTextField(30);
    JTextField txfOrder_No=new JTextField(30);
    JTextField txfResult=new JTextField(30);
    JButton jbtnSave=new JButton("Save");
    JButton jbtnClear=new JButton("Clear");
    JButton jbtnExit=new JButton("Exit");
    conMarketingPane.add(lblCustomer_Id);
    conMarketingPane.add(lblCustomer_Name);
    conMarketingPane.add(lblCompany_Name);
    conMarketingPane.add(lblDesignation);
    conMarketingPane.add(lblAddress1);
    conMarketingPane.add(lblAddress2);
    conMarketingPane.add(lblQuantity);
    conMarketingPane.add(lblUnit_Price);
    conMarketingPane.add(lblInterest_Level);
    conMarketingPane.add(lblContact_No);
    conMarketingPane.add(lblMobile_No);
    conMarketingPane.add(lblEmail);
    conMarketingPane.add(lblEmployee_Id);
    conMarketingPane.add(lblCampaign_Date);
    conMarketingPane.add(lblNext_Appointment);
    conMarketingPane.add(lblCampaign_Id);
    conMarketingPane.add(lblTeam_Id);
    conMarketingPane.add(lblOrder_No);
    conMarketingPane.add(lblResult);
    conMarketingPane.add(txfCustomer_Id);
    conMarketingPane.add(txfCustomer_Name);
    conMarketingPane.add(txfCompany_Name);
    conMarketingPane.add(txfDesignation);
    conMarketingPane.add(txfAddress1);
    conMarketingPane.add(txfAddress2);
    conMarketingPane.add(txfQuantity);
    conMarketingPane.add(txfUnit_Price);
    conMarketingPane.add(txfInterest_Level);
    conMarketingPane.add(txfContact_No);
    conMarketingPane.add(txfMobile_No);
    conMarketingPane.add(txfEmail);
    conMarketingPane.add(txfEmployee_Id);
    conMarketingPane.add(txfCampaign_Date);
    conMarketingPane.add(txfNext_Appointment);
    conMarketingPane.add(txfCampaign_Id);
    conMarketingPane.add(txfTeam_Id);
    conMarketingPane.add(txfOrder_No);
    conMarketingPane.add(txfResult);
    conMarketingPane.add(jbtnSave);
    conMarketingPane.add(jbtnClear);
    conMarketingPane.add(jbtnExit);
    setSize(900,900);
    setVisible(true);
    lblCustomer_Id.setLocation(50,50);
    lblCustomer_Name.setLocation(50,70);
    lblCompany_Name.setLocation(50,90);
    lblDesignation.setLocation(50,110);
    lblAddress1.setLocation(50,130);
    lblAddress2.setLocation(50,150);
    lblQuantity.setLocation(50,170);
    lblUnit_Price.setLocation(50,190);
    lblInterest_Level.setLocation(50,210);
    lblContact_No.setLocation(50,230);
    lblMobile_No.setLocation(50,250);
    lblEmail.setLocation(50,270);
    lblEmployee_Id.setLocation(50,290);
    lblCampaign_Date.setLocation(50,310);
    lblNext_Appointment.setLocation(50,330);
    lblCampaign_Id.setLocation(50,350);
    lblTeam_Id.setLocation(50,370);
    lblOrder_No.setLocation(50,390);
    lblResult.setLocation(50,410);
    txfCustomer_Id.setLocation(250,50);
    txfCustomer_Name.setLocation(250,70);
    txfCompany_Name.setLocation(250,90);
    txfDesignation.setLocation(250,110);
    txfAddress1.setLocation(250,130);
    txfAddress2.setLocation(250,150);
    txfQuantity.setLocation(250,170);
    txfUnit_Price.setLocation(250,190);
    txfInterest_Level.setLocation(250,210);
    txfContact_No.setLocation(250,230);
    txfMobile_No.setLocation(250,250);
    txfEmail.setLocation(250,270);
    txfEmployee_Id.setLocation(250,290);
    txfCampaign_Date.setLocation(250,310);
    txfNext_Appointment.setLocation(250,330);
    txfCampaign_Id.setLocation(250,350);
    txfTeam_Id.setLocation(250,370);
    txfOrder_No.setLocation(250,390);
    txfResult.setLocation(250,410);
    jbtnSave.setLocation(250,450);
    jbtnClear.setLocation(350,450);
    jbtnExit.setLocation(450,450);
    txfCustomer_Id.setRequestFocusEnabled(true);
    txfCustomer_Id.requestFocus();
    jbtnSave.addActionListener(this);
    jbtnClear.addActionListener(this);
    jbtnExit.addActionListener(this);
    public void actionPerformed(ActionEvent ae)
    if(ae.getSource().equals(jbtnSave))
    //' &txfAddress1& ',' &txfAddress2& ',' &txfQuantity& ',
    //' &txfUnit_Price& ',' &txfInterest_Level& ',' &txfContact_No& ',
    //' &txfMobile_No& ',' &txfEmail& ',' &txfEmployee_Id& ',' &txfCampaign_Date& ',
    //' &txfNext_Appointment& ',' &txfCampaign_Id& ',' &txfTeam_Id& ',' &txfOrder_No& ',' &txfResult& '
    try
    Class.forName("jdbc.odbc.JdbcOdbcDriver");
    Connection connCampaign=DriverManager.getConnection("jdbc:odbc:CRMSource");
    Statement stmtCampaign=connCampaign.createStatement();
    /* stmt.executeUpdate("insert into Campaign values('" &jtxfCustomer_ID& "',&jtxfCustomer_Name&,
    ' &jtxfCustomer_ID& ',' &txfCompany_Name& ',' &txfDesignation& ',' &txfAddress1& ',' &txfAddress2& ',
    ' &txfQuantity& ',' &txfUnit_Price& ',' &txfInterest_Level& ',' &txfContact_No& ',
    ' &txfMobile_No& ',' &txfEmail& ',' &txfEmployee_Id& ',' &txfCampaign_Date& ',
    ' &txfNext_Appointment& ',' &txfCampaign_Id& ',' &txfTeam_Id& ',' &txfOrder_No& ',' &txfResult& ')");*/
    JOptionPane.showMessageDialog(this,"Statement was saved");
    catch(Exception ex)
    ex.printStackTrace();
    I got "unclosed character literal" error when i tried to execute the above java source file .
    help me to get the required result.

  • Copy command for SQL*Plus

    Am trying to use the copy command in SQL*Plus to copy a table
    from an Oracle database to a local table on my machine in
    another format. Keep getting errors. It seems to contact the
    remote machine fine, but can't locate my local machine or figure
    out where to put it. Any suggestions on how to set up my
    Windows 95 machine to get the copy command working would be
    greatly appreciated. Thank you.
    null

    Hi,
    Here is an example :
    SQL> copy from scott/tiger@q4_production_server create ord -
    using select * from ord;Array fetch/bind size is 15. (arraysize is 15)
    Will commit when done. (copycommit is 0)
    Maximum long size is 80. (long is 80)
    Table ORD created.
    21 rows selected from scott@q4_production_server.
    21 rows inserted into ORD.
    21 rows committed into ORD at DEFAULT HOST connection.
    Hope this helps,
    Bala
    Laura Michaels (guest) wrote:
    : Am trying to use the copy command in SQL*Plus to copy a table
    : from an Oracle database to a local table on my machine in
    : another format. Keep getting errors. It seems to contact the
    : remote machine fine, but can't locate my local machine or
    figure
    : out where to put it. Any suggestions on how to set up my
    : Windows 95 machine to get the copy command working would be
    : greatly appreciated. Thank you.
    null

  • Insert command do not work on MII

    I have the following insert command in a Fixed SQL action:.
    insert into SOLICITACAO
        (USUARIO_CRIADOR, LOCAL_ORIGEM, CAPACIDADE, SITUACAO, DATA_CRIACAO, TIPO, USUARIO_SOLICITANTE)
    values
        (1, 1, 25, 'A', TO_DATE('10-10-2009 12:33:33', 'DD-MM-YYYY HH24:MI:SS'), 'M', 1)
      This insert command works with no problem when I execute it using some software to connect to my oracle database.
      Inside MII I have an error:
    com.sap.xmii.Illuminator.logging.LHException: SQL error has occurred on query ORA-00900: invalid SQL statement
      What could be wrong here?
    Nuno Cunha

    Hi,
      Oooops! Thank you very much.
    Nuno Cunha

  • How to overcome Dump during Insert Command

    Hi Abappers,
    When I am trying to upload the text file into the Database,
    I am using Insert command using internal table.
    When the record exist, it gives dump saying duplicate records.
    How to convert that dump into the error message?
    Please Reply.
    Regards,
    Rahul

    Rahul,
    Insert FROM TABLE itab [ACCEPTING DUPLICATE KEYS]
    Effect
    If you specify an internal table itab, several rows are created from its content for insertion in the database table. A row for insertion into the table is taken from each row of the internal table according to the same rules as for a single work area Einfügenwa. The line type of the internal table has to meet the prerequisites for use in Open-SQL statements.
    If a row witht he same primary key or a same unique secondary index does not already exist in the database table for any of the rows to be inserted, all rows are inserted and sy-subrc is set to 0. If the internal table is empty, sy-subrc is also set to 0. The system field sy-dbcnt is always set to the number of rows that were actually inserted.
    If a row with the same primary key or a same unique secondary index already exists in the database table for one or more of the rows to be inserted, these rows cannot be inserted. In this situation, there are three possibilities:
    Use of ACCEPTING DUPLICATE KEYS
    If the addition ACCEPTING DUPLICATE KEYS is specified, all rows are inserted for which this is possible. The remaining rows are rejected and sy-subrc is set to 4. The system field sy-dbcnt is set to the number of lines that are inserted.
    Handling an exception
    If the addition ACCEPTING DUPLICATE KEYS is not specified, a treatable exception occurs CX_SY_OPEN_SQL_DB (it always occurs since Release 6.10). Rows are inserted until the exception occurs. The number of rows that are inserted is not defined. The system fields sy-subrc and sy-dbcnt retain their previous value.
    Runtime error
    If the addition ACCEPTING DUPLICATE KEYS is not specified and if the exception is not handled, then a runtime error occurs (it always occurs prior to Release 6.10). This executes a database rollback that reverses all changes to the current database LUW. This applies in particular to rows that were inserted before a double entry occurred.
    i would also suggest you to see SAP help by pressing F1 because some time may we miss but SAP never.
    Amit.

  • Custom SharePoint 2010 designer page throws "The data source control failed to execute the insert command" exception while adding the new item after the August 13, 2013 CU has installed

    We have the SharePoint Server 2010 with SP1 environment on which the custom SP2010 designer pages were working as expected before the
    August 13, 2013 CU has installed. But, getting the below exception while trying to add the new item after the CU has installed.
    Error while executing web part: System.NullReferenceException: Object reference not set to an instance of an object.     at Microsoft.SharePoint.WebControls.SPDataSourceView.ExecuteInsert(IDictionary values)     at
    System.Web.UI.DataSourceView.Insert(IDictionary values, DataSourceViewOperationCallback callback) 3b64c3a0-48f3-4d4a-af54-d0a2fc4553cc
    06/19/2014 16:49:37.65  w3wp.exe (0x1240)                        0x1300 SharePoint Foundation        
     Runtime                        tkau Unexpected Microsoft.SharePoint.WebPartPages.DataFormWebPartException: The data source control
    failed to execute the insert command. 3b64c3a0-48f3-4d4a-af54-d0a2fc4553cc    at Microsoft.SharePoint.WebPartPages.DataFormWebPart.InsertCallback(Int32 affectedRecords, Exception ex)     at System.Web.UI.DataSourceView.Insert(IDictionary
    values, DataSourceViewOperationCallback callback)     at Microsoft.SharePoint.WebPartPages.DataFormWebPart.FlatCommit()     at Microsoft.SharePoint.WebPartPages.DataFormWebPart.HandleOnSave(Object sender, EventArgs e)    
    at Microsoft.SharePoint.WebPartPages.DataFormWebPart.RaisePostBackEvent(String eventArgument)     at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)     at System.Web.UI.Page.ProcessRequestMain(Boolean
    inclu... 3b64c3a0-48f3-4d4a-af54-d0a2fc4553cc
    06/19/2014 16:49:37.65* w3wp.exe (0x1240)                        0x1300 SharePoint Foundation        
     Runtime                        tkau Unexpected ...deStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 3b64c3a0-48f3-4d4a-af54-d0a2fc4553cc
    I have tried changing the "DataSourceMode" as below, now the insert command is working, but update command is not working.
    <SharePoint:SPDataSource runat="server" DataSourceMode="ListItem" />
    Also, the lookup dropdown fields are displaying the value as "<a href="Daughterhttp://cpsp10/sites/Employees/_layouts/listform.aspx?PageType=4&ListId={8F62F444-FB6A-4F03-9522-C4696B45DCD1}&ID=10&RootFolder=*">Daughter</a>"
    instead of only "Daughter".
    Please provide the solution to get rid of this issue.
    Thanks
    Ramasubbu

    Try below:
    http://social.technet.microsoft.com/Forums/en-US/ae910269-3a0c-4506-844b-e8bc89d95b71/data-source-control-failed-to-execute-the-insert-command
    http://blog.jussipalo.com/2012/01/sharepoint-2010-data-source-control.html
    While there can be many causes for this generic error message, in my case the first parameter or ddwrt:DataBind function inside the SharePoint:FormFields element was
    'i' and I was working with an Edit Form. Changing it to
    'u' as it was with every other FormField fixed the issue.
    <SharePoint:FormField runat="server" id="ff1{$Pos}" ControlMode="Edit" FieldName="Esittaja" __designer:bind="{ddwrt:DataBind('u',concat('ff1',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Esittaja')}"
    />
    Explanation:
    DataBind operation type parameters (the first parameter) are listed below:
    'i' stands for INSERT,
    'u' stands for UPDATE,
    'd' stands for DELETE.
    http://webcache.googleusercontent.com/search?q=cache:d9HHY4I7omgJ:thearkfloats.blogspot.com/2014/03/sharepoint-2010-data-source-control.html+&cd=4&hl=en&ct=clnk&gl=in
    If this helped you resolve your issue, please mark it Answered

  • Error upon inserting data in sql Database using stream analytics job: Datatye error conversion

    I have a data passed into the Event Hubs, queried by stream analytic job inserting it into sql database. Upon running the job, it becomes idle a few seconds after since it has an error:
    Message: Conversion from 0 to System.Boolean failed. 0 was of type - System.Int64.
    Conversion from 0 to System.Boolean failed. 0 was of type - System.Int64. Exception message at level [1], exception number [0], parent exception number [0]: Conversion from 0 to System.Boolean failed. 0 was of type - System.Int64.
    The data type in one of my field(IsHistorical) is Boolean with a value of false. The data type of the column in the sql table where this is to be inserted is of type bit. In this case, it seems that stream analytics could not convert the value "false"
    into a bit data type when inserting in sql table.
    I'm wondering if you already have encountered this problem. Could you help me resolve this problem?
    Thank you.

    Azure Stream Analytics does not have Boolean type. On input we will convert JSON Boolean value to bigint.
    Here is the list of supported types and conversions:
    https://msdn.microsoft.com/en-us/library/azure/dn835065.aspx 
    You  can fix this erro by changing column type from bit to int in SQL table schema.

  • Error when insert data in Sql Server table(DateTime data type)

    Hello all,
    I have created a database link in oracle 11g to SQL Server 2008 using Sqlserver gateway for oracle,Oracle run on Linux and SQL Server run on Windows platform.
    I have queried a table and it fetches rows from the target table.
    I am using this syntax for insert a row in Sql Server table.
    Insert into Prod@sqlserver (NUMITEMCODE, NUMPREOPENSTOCK, NUMQNTY, NUMNEWOPENSTOCK, DATPRODDATE , TXTCOMPANYCODE, "bolstatus", NUMRESQNTY )
    Values (1118 , 1390.0 , 100.0 ,1490 , '2012-06-23 12:37:58.000','SFP' ,0 , 0 );
    but it give me error on DATPRODDATE,The data type of DATPRODDATE column in Sql Server is DATETIME.
    My Question is how can i pass the date values in INSERT statement for Sql Server DateTime data type.
    Regards

    Just as with Oracle, you have to specify the date using the to_date() function or use the native date format for the target database (if you can figure out what that is). This is good practice anyway and a good habit to get into.

  • Error while inserting data in SQL Server.

    Hi',
    I am using SOA 11.1.1.5
    I am inserting data using DB adapter in MS SQL Server. Some times I get below error.
    Error Message: {http://schemas.oracle.com/bpel/extension}bindingFault
    Fault ID     rrr/xxx!1.1*soa_313bd437-7bb9-41c6-a719-d1775b9afc4b/xx/4115908-BpInv0-BpSeq1.6-4
    Fault Time     Dec 24, 2012 8:02:09 AM
    Non Recoverable System Fault :
    <bpelFault><faultType>0</faultType><bindingFault xmlns="http://schemas.oracle.com/bpel/extension"><part name="summary"><summary>Exception occured when binding was invoked. Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'insert' failed due to: DBWriteInteractionSpec Execute Failed Exception. insert failed. Descriptor name: [InsertIntoStagingxx.Stagingxx]. Caused by java.sql.BatchUpdateException: String or binary data would be truncated.. Please see the logs for the full DBAdapter logging output prior to this exception. This exception is considered not retriable, likely due to a modelling mistake. To classify it as retriable instead add property nonRetriableErrorCodes with value "-8152" to your deployment descriptor (i.e. weblogic-ra.xml). To auto retry a retriable fault set these composite.xml properties for this invoke: jca.retry.interval, jca.retry.count, and jca.retry.backoff. All properties are integers. ". The invoked JCA adapter raised a resource exception. Please examine the above error message carefully to determine a resolution. </summary></part><part name="detail"><detail>String or binary data would be truncated.</detail></part><part name="code"><code>8152</code></part></bindingFault></bpelFault>
    Please advice.
    Thanks
    Yatan

    Hi Yatan,
    This should be due to data issues. And the error message is due to data truncation issues.
    Please check your payload that you are trying to insert into the SQL server table.
    One or more fields might have a data that is exceeding its defined length with respect to the table definitions.
    Problem with using SQL server is that while inserting, you will not be pointed towards which field or column is causing the error.
    You have to take the pain of searching through the entire payload to find the problem causing ones.
    Thanks,
    Deepak.

  • Copy command in SQL

    What is the Copy Command in SQL ?

    COPY Command is used to COPY database table from one Schema to another Schema.

  • Using insert command in NVL function

    How can we use insert command in a NVL function
    exapmle : INSERT INTO employee
    VALUES ( (NVL ( (SELECT emp_id
    FROM employee
    WHERE emp_name LIKE 'Test'),
    (insert into employee values((select max(emp_id)+1 from employee),'Test')))));
    I mean i will check for the record to exist in the table and if not exist i will add it to the table.

    998504 wrote:
    How can we use insert command in a NVL function
    exapmle : INSERT INTO employee
    VALUES ( (NVL ( (SELECT emp_id
    FROM employee
    WHERE emp_name LIKE 'Test'),
    (insert into employee values((select max(emp_id)+1 from employee),'Test')))));
    I mean i will check for the record to exist in the table and if not exist i will add it to the table.The first thing caught my eye is this
    max(emp_id) +1A real bad piece of code. Never do that. Ever thought about multi user environment? Use a SEQUENCE.
    If you want EMP_NAME to be unique (Which looks strange to me), then just add a UNIQUE constraint. You dont try to do what oracle already does really well.

  • HOW TO INSERT DATA INTO SQL SERVER FROM MS ACCESS TABLE??

    NEED TO INSERT DATA INTO SQL SERVER FROM MS ACCESS TABLE.

    this is another method
    http://www.mssqltips.com/sqlservertip/2484/import-data-from-microsoft-access-to-sql-server/
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Xcopy Command From Sql

    Dear Guru's,
    I have Script of my all the procedure.
    After all procedure gets execute, As a output it create .csv files.
    This .csv files i manually copy past on one of my directory.
    For avoiding this manual copy past i want to use xcopy command from sql itself.
    Please guide me how do i do this.
    Regards,
    Chanchal wankhade.

    CHACHA wrote:
    I have Script of my all the procedure.
    After all procedure gets execute, As a output it create .csv files.
    This .csv files i manually copy past on one of my directory.
    For avoiding this manual copy past i want to use xcopy command from sql itself.
    Please guide me how do i do this.Do not like the sound of the architecture you are using for this. Scripts? Scripts for Oracle should be limited to installing s/w.
    Writing any kind of Oracle application using scripts, is questionable ito design, robustness, flexibility, security and so on.
    Wanting to use console commands from a SQL cursor? That sounds even more broken and wrong. If you want to do o/s calls, it should be done carefully and securely from PL/SQL code.
    And PL/SQL code should be inside the database - not outside in some script.
    As for copying files. Realise that SQL and PL/SQL code executes on the server inside an Oracle server process. This does not have access to your client's file system and directories.

Maybe you are looking for